Azure AD appending '#EXT#' to UserPrincipalName

Mau*_*loa 4 azure azure-active-directory azure-ad-graph-api azure-ad-b2c

When we create a user in Active Directory using Graph API, some characters are appended to the username (#EXT#). This makes impossible to edit the user in AD B2C's interface (documented problem) or doing sign-in using ADAL 2.23 (Active Directory Authentication Library).

AD B2C接口问题

Particularly, there's an error (unknown_user_type) when we use AcquireToken(username, password) method. The error is the following:

ADAL错误

为什么会这样?是否有针对此问题的任何解决方案或解决方法?

问候。

Phi*_*ret 5

有用户#EXT#在他们的UserPrincipalName(UPN,也含糊称在几个地方“用户名”),通常是已经从其他标识提供者采购的用户。这包括:

  1. 常规目录:使用 Microsoft 帐户 (MSA) 添加的用户
  2. 常规目录:来自 Azure AD 中其他目录的用户
  3. B2C 目录:几乎所有 B2C 用户都有这个

常规目录

如果你的应用程序知道在Azure AD目录中的用户试图登录的,你正在使用的租户特定端点,而不是承租人无关的终点,如果用户(1)和(2)应能使用 ADAL 使用应用程序登录。登录时,他们将使用 MSA 或“主”目录中的常规用户名。https://login.microsoftonline.com/<domain or ID>https://login.microsoftonline.com/common

示例:bob@contoso.com来自目录的用户contoso被添加为目录中的外部用户fabrikam。这会导致用户fabrikam使用 UPN bob_contoso.com#EXT#@fabrikam.onmicrosoft.com,但您不必担心。当他们登录受信任的应用程序时https:/login.microsoftonline.com/fabrikam.onmicrosoft.com,他们只需bob@contoso.com使用contoso.

B2C目录

Azure AD B2C 感知应用程序始终使用特定于租户的终结点,但它使用较新的“v2”OAuth 2.0 终结点:

  • https://login.microsoftonline.com/<domain or ID>/oauth2/v2.0/authorize
  • https://login.microsoftonline.com/<domain or ID>/oauth2/v2.0/token

同样——用户将始终使用他们的家庭身份提供者登录。

重要提示:请记住,Azure AD B2C 目前处于预览阶段(截至 2106 年 3 月)。

特尔;博士

如果用户的 UserPrincipalName 包含#EXT#,则您实际上不应该希望更改用户的 UserPrincipalName ,因为这意味着这实际上不是他们在登录时要输入的用户名。