癥狀
試想以下情況:
- 您的組織有混合式Microsoft Exchange環境。
- 自動探索會指向本地部署的 Exchange Server。
- 您有 Microsoft Outlook 2016 Professional MSI 用戶端。
在此案例中,當您嘗試將 Exchange Online 電子郵件帳戶新增至 Outlook 時,新式驗證提示會在您輸入 Exchange Online 認證之後空白。 因此,您無法繼續將帳戶新增至預設 Outlook 配置檔。
原因
當您輸入憑證時,Outlook 用戶端會連線至 Exchange Online,以請求內部部署 Autodiscover 資源原理的 OAuth 令牌。 不過,驗證失敗,因為資源主體為:
- Microsoft Entra 租戶中的服務主體名稱 (SPNs) 清單中缺失
- 在 Microsoft Entra 租戶內處於無效狀態
解決辦法
若要將 Exchange Online 電子郵件帳戶新增至 Outlook,請使用下列其中一個解決方法。
決議案 1
使用隨選即用版本的 Outlook。
注意:Outlook 隨選即用版本會決定用戶帳戶是否存在於 Exchange Online 中,如 Outlook 2016 自動探索實作步驟 4 中所述。
決議案 2
使用下列步驟,將遺漏的自動探索資源原則新增至 Microsoft Entra 租使用者中的 SPN 清單:
使用下列其中一種方法來判斷資源主體名稱:
搜尋 Microsoft Entra 登入記錄 ,以取得下列登入失敗訊息:
"status": { "errorCode": 500011, "failureReason": "The resource principal named <resource principal name> was not found in the tenant named <tenant name>. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant."
從記錄訊息取得資源主體名稱。
當您輸入認證以新增 Exchange Online 電子郵件帳戶時,請使用網路協定分析器來擷取網路流量。 搜尋已擷取的網路流量,查找具有下列所有項目的POST請求:
包含
oauth2/token HTTP/1.1
的端點 URLHTTP 回應狀態代碼 400 (不正確的要求)
回應本文中類似下列訊息的錯誤訊息:
{"error":"invalid_resource","error_description":"AADSTS500011: The resource principal named <resource principal name> was not found in the tenant named <tenant name>. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.
從錯誤訊息取得資源主體名稱。
資源主體名稱的範例為
https://autodiscover.contoso.com
。依照 步驟 5:註冊內部和外部內部部署 Exchange HTTP 端點的所有主機名授權單位中描述的程式,將資源主體名稱新增至 Microsoft Entra 租用戶中的 SPN 清單。
確認資源主體名稱位於 Microsoft Entra ID 的 SPN 清單中:
執行下列 Cmdlet 來安裝和連線至 Microsoft Graph:
Install-Module Microsoft.Graph.Applications Import-Module Microsoft.Graph.Applications Connect-MgGraph -Scopes Application.Read.All
出現提示時, 請登入以授與同意。
執行下列 Cmdlet 以列出 Microsoft Entra ID 中的 SPN:
$ServiceName = "00000002-0000-0ff1-ce00-000000000000" Get-MgServicePrincipal -Filter "AppId eq '$ServiceName'" | Select-Object -ExpandProperty ServicePrincipalNames | Sort-Object
小提示
若要確認內部部署 Exchange Server 和 Exchange Online 端點可以 成功驗證彼此的要求 ,請使用 Test-OAuthConnectivity Cmdlet。