共用方式為


使用 Set-MsolADFSContext 命令時發生錯誤:<ServerName> Active Directory 同盟服務 2.0 伺服器連線失敗

原始 KB 編號: 2587730

癥狀

當您在適用於 Windows PowerShell 的 Microsoft Azure Active Directory 模組中執行 Set-MsolADFSContext -Computer 命令時,您會收到下列錯誤:

Set-MsolADFSContext:<ServerName> Active Directory 同盟服務 2.0 伺服器連線失敗,因為認證無效。

原因

如果未在 active Directory 同盟服務 (AD FS) 同盟伺服器上啟用遠端 PowerShell,-computer 參數參考,就會發生此錯誤。

在入口網站中正確新增並驗證網域時,您可以使用適用於 Windows PowerShell 的 Azure Active Directory 模組,透過遠端 PowerShell 從管理工作站設定單一登錄(SSO)。

不過,適用於 Windows PowerShell 的 Azure Active Directory 模組只能安裝在 Windows 7 和 Windows Server 2008 SR2 上。 Windows PowerShell 的 Azure Active Directory 模組無法安裝在 Windows Server 2008 Service Pack 2 (SP2) 上。 因此,此問題特別與在 Windows Server 2008 SP2 平臺上安裝 AD FS 時特別相關。 在此情況下,必須從遠端電腦發出與 AD FS 相關的 Windows PowerShell 命令 Azure Active Directory 模組。

決議

若要在AD FS 同盟伺服器上啟用遠端 PowerShell,請遵循下列步驟:

  1. 以系統管理員身分啟動 PowerShell。 若要這樣做,請以滑鼠右鍵按兩下 Windows PowerShell 快捷方式,然後選取 [ 以系統管理員身分執行]。

  2. 若要設定 Windows PowerShell 進行遠端處理,請輸入下列命令,然後按 Enter:

    Enable-PSRemoting -force
    

詳細資訊

如需遠端 PowerShell 需求的詳細資訊,請參閱 About_Remote_Requirements

如需瞭解更多關於遠端 PowerShell 功能的資訊,請參考 Windows PowerShell:深入探討遠端使用

仍然需要協助嗎? 移至 Microsoft 社群Microsoft Entra 論壇 網站。