【发布时间】:2019-09-17 09:51:53
【问题描述】:
我正在使用 MSAL 通过集成 Windows 身份验证从 Azure 中的身份验证应用获取令牌。 代码是:
var tenant = $"https://login.microsoftonline.com/<myTenantId>";
var clientId = "<myClientId>";
var scopes = new string[] { "https://graph.microsoft.com/.default" };
var publicApplication = PublicClientApplicationBuilder.Create(clientId).WithAuthority(tenant).Build();
var token = await publicApplication.AcquireTokenByIntegratedWindowsAuth(scopes).ExecuteAsync();
这会引发以下异常:
Integrated Windows Auth is not supported for managed users.
- 我已验证运行该应用程序的用户不是 托管用户(用户在本地 AD 中创建并同步到 Azure AD 通过 AD Connect 同步)。
- 我已经在我的 Azure 租户中启用了 SSO 并具有直通功能 身份验证。
- 管理员已同意授权申请。
我已按照https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Integrated-Windows-Authentication 的步骤进行操作,据我所知,我没有错过任何内容。
我的配置中是否有遗漏的内容?对此的任何帮助都非常感谢。
【问题讨论】:
-
只要确定运行这个的设备是AD还是AAD加入?
-
错误来自这里,好像它认为它是一个托管环境? github.com/AzureAD/microsoft-authentication-library-for-dotnet/…
-
@juunas 该设备已加入混合 Azure AD。
标签: azure azure-active-directory azure-ad-graph-api msal azure-authentication