首页 > 解决方案 > MSAL - 使用 IntegratedWindowsAuth 获取令牌时出现问题

问题描述

我正在使用 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.

我已按照https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Integrated-Windows-Authentication中的步骤进行操作,据我所知,我没有错过任何内容。

我的配置中是否有一些我可能遗漏的东西?对此的任何帮助都将受到高度赞赏。

标签: azureazure-active-directoryazure-ad-graph-apimsalazure-authentication

解决方案


根据我与 Microsoft 的讨论,直通身份验证不支持 IWA(在我的情况下就是这种情况)。要使 IWA 正常工作,我们需要在我们的环境中安装 ADFS。


推荐阅读