MSAL - 使用 IntegratedWindowsAuth 获取令牌时出现问题
MSAL - Problem acquiring token with IntegratedWindowsAuth
我正在使用 MSAL 从 Azure 中使用集成 windows 身份验证的身份验证应用程序获取令牌。
代码是:
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 中的步骤进行操作,据我所知,我没有遗漏任何内容。
我的配置中是否遗漏了什么?非常感谢这方面的任何帮助。
IWA 仅支持联合用户,即在 Active Directory 中创建并由 Azure Active Directory 支持的用户。
尝试检查您的用户是否被识别为联合用户而非托管用户。
并参考这个code sample。
根据我与 Microsoft 的讨论,传递身份验证不支持 IWA(这是我的情况)。要使 IWA 工作,我们的环境中需要有 ADFS。
我正在使用 MSAL 从 Azure 中使用集成 windows 身份验证的身份验证应用程序获取令牌。 代码是:
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 中的步骤进行操作,据我所知,我没有遗漏任何内容。
我的配置中是否遗漏了什么?非常感谢这方面的任何帮助。
IWA 仅支持联合用户,即在 Active Directory 中创建并由 Azure Active Directory 支持的用户。
尝试检查您的用户是否被识别为联合用户而非托管用户。
并参考这个code sample。
根据我与 Microsoft 的讨论,传递身份验证不支持 IWA(这是我的情况)。要使 IWA 工作,我们的环境中需要有 ADFS。