【问题标题】:MSAL - Problem acquiring token with IntegratedWindowsAuthMSAL - 使用 IntegratedWindowsAuth 获取令牌时出现问题
【发布时间】: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 的步骤进行操作,据我所知,我没有错过任何内容。

我的配置中是否有遗漏的内容?对此的任何帮助都非常感谢。

【问题讨论】:

标签: azure azure-active-directory azure-ad-graph-api msal azure-authentication


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    IWA 仅支持联合用户,即在 Active Directory 中创建并由 Azure Active Directory 支持的用户。

    尝试检查您的用户是否被识别为联合用户而不是托管用户。

    并参考这个code sample

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-02
      • 2011-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-19
      • 2021-07-17
      • 1970-01-01
      相关资源
      最近更新 更多