Azure AD B2C 中的多租户 Azure AD
Multi-tenant Azure AD in Azure AD B2C
我在关注这里的答案:
但是我无法登录,错误消息大致如下:
AADB2C: An exception has occured. Correlation ID: <GUID>. Timestamp: <Time>
此外,在最新的主控中查看演练时,整个页面已被删除,现在只包含 link 到 https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-setup-aad-custom,其中没有显示如何为多租户配置 ClaimsProvider Azure AD IDP。
错误消息不是很有用,我迷路了。
我的技术简介如下:
<ClaimsProvider>
<Domain>AzureAD</Domain>
<DisplayName>Login using Azure AD</DisplayName>
<TechnicalProfiles>
<TechnicalProfile Id="AzureADProfile">
<DisplayName>Azure AD</DisplayName>
<Description>Login with your Azure AD account</Description>
<Protocol Name="OpenIdConnect"/>
<OutputTokenFormat>JWT</OutputTokenFormat>
<Metadata>
<Item Key="DiscoverMetadataByTokenIssuer">true</Item>
<Item Key="ValidTokenIssuerPrefixes">https://login.microsoftonline.com/</Item>
<Item Key="authorization_endpoint">https://login.windows.net/common/oauth2/v2.0/authorize</Item>
<Item Key="client_id">MyAzureADB2CAppId</Item>
<Item Key="IdTokenAudience">MyAzureADB2CAppId</Item>
<Item Key="response_types">id_token</Item>
<Item Key="UsePolicyInRedirectUri">false</Item>
<Item Key="BearerTokenTransmissionMethod">AuthorizationHeader</Item>
<Item Key="scope">openid</Item>
<Item Key="HttpBinding">POST</Item>
</Metadata>
<CryptographicKeys>
<Key Id="client_secret" StorageReferenceId="B2C_1A_B2CSecret"/>
</CryptographicKeys>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="socialIdpUserId" PartnerClaimType="oid"/>
<OutputClaim ClaimTypeReferenceId="tenantId" PartnerClaimType="tid"/>
<OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="unique_name" />
<OutputClaim ClaimTypeReferenceId="givenName" PartnerClaimType="given_name" />
<OutputClaim ClaimTypeReferenceId="surName" PartnerClaimType="family_name" />
<OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="name" />
<OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="azureADAuthentication" />
<OutputClaim ClaimTypeReferenceId="identityProvider" DefaultValue="AzureAD" />
</OutputClaims>
<OutputClaimsTransformations>
<OutputClaimsTransformation ReferenceId="CreateRandomUPNUserName"/>
<OutputClaimsTransformation ReferenceId="CreateUserPrincipalName"/>
<OutputClaimsTransformation ReferenceId="CreateAlternativeSecurityId"/>
<OutputClaimsTransformation ReferenceId="CreateSubjectClaimFromAlternativeSecurityId"/>
</OutputClaimsTransformations>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop"/>
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>
编辑: 在按照 spottahhn 的建议引入 User Journey Recorder 之后,我设法得到了真正的错误:
The response received from the ClaimsProvider using TechnicalProfile
"<My_Azure_AD_Common_Profile>" in policy "<My_RP_Policy>" of tenant
"<My_B2C_Tenant>" did not contain an "id_token".
问题是:link将多租户 Azure AD 连接到 Azure AD B2C 是否仍然受支持,我如何配置才能使其正常工作?
将 Azure AD B2C 与 Azure AD 的公共端点联合时,您可以与以下任一集成:
- v1.0 端点:
https://login.microsoftonline.com/common/oauth2/authorize
- v2.0 端点:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
v1.0 端点
要将 Azure AD B2C 与 v1.0 端点集成,您必须通过 the Azure portal 向您的 Azure AD 租户注册 Azure AD B2C:
- 登录到 Azure 门户。
- 在顶部栏中,select 您的 Azure AD 目录。
- 在左侧栏中,select 所有服务 并找到 "App registrations".
- Select新申请注册.
- 在名称中输入一个应用程序名称,例如"Azure AD B2C".
- 在应用程序类型、select 网络应用/API.
- 在 Sign-on URL 中,输入
https://login.microsoftonline.com/te/<tenant>/oauth2/authresp
,将 <tenant>
替换为您的 Azure AD B2C 的名称租户(例如"contosob2c.onmicrosoft.com")。
- Select 创建.
- 复制应用程序 ID 以备后用。
- Select 设置然后select键.
- 在密码部分,输入密码说明,select密码持续时间,select 保存 , 然后复制密码值以备后用。
然后您必须使用步骤 11 中的应用程序机密通过 Azure AD B2C 门户创建策略密钥(例如 "AzureADClientSecret")。
然后您必须使用以下设置更新 Azure AD 技术配置文件:
<TechnicalProfile Id="AzureADAccountProfile">
<DisplayName>Log in with your work account</DisplayName>
<Protocol Name="OpenIdConnect"/>
<OutputTokenFormat>JWT</OutputTokenFormat>
<Metadata>
<Item Key="authorization_endpoint">https://login.microsoftonline.com/common/oauth2/authorize</Item>
<Item Key="client_id"><!-- Enter the application ID from step 9 --></Item>
<Item Key="DiscoverMetadataByTokenIssuer">true</Item>
<Item Key="HttpBinding">POST</Item>
<Item Key="IdTokenAudience"><!-- Enter the application ID from step 9 --></Item>
<Item Key="response_types">id_token</Item>
<Item Key="scope">openid</Item>
<Item Key="UsePolicyInRedirectUri">false</Item>
<Item Key="ValidTokenIssuerPrefixes">https://sts.windows.net/</Item>
</Metadata>
<CryptographicKeys>
<Key Id="client_secret" StorageReferenceId="B2C_1A_AzureADClientSecret"/>
</CryptographicKeys>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="enterpriseAuthentication" />
<OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="name" />
<OutputClaim ClaimTypeReferenceId="identityProvider" DefaultValue="tid" />
<OutputClaim ClaimTypeReferenceId="socialIdpUserId" PartnerClaimType="oid" />
...
</OutputClaims>
<OutputClaimsTransformations>
<OutputClaimsTransformation ReferenceId="CreateRandomUPNUserName"/>
<OutputClaimsTransformation ReferenceId="CreateUserPrincipalName"/>
<OutputClaimsTransformation ReferenceId="CreateAlternativeSecurityId"/>
</OutputClaimsTransformations>
<UseTechnicalProfileForSessionManagement ReferenceId="ReferenceId="SM-Noop" />
</TechnicalProfile>
v2.0 端点
要将 Azure AD B2C 与 v2.0 端点集成,您必须通过 the Application Registration portal 向您的 Azure AD 租户注册 Azure AD B2C:
- 登录到应用程序注册门户。
- Select 添加应用.
- 在应用程序名称中,输入一个应用程序名称,例如"Azure AD B2C",然后select 创建 .
- 复制应用程序 ID 以备后用。
- 在 Application Secrets 部分,select 生成新密码 然后复制密码值以备后用。
- 在平台部分,select添加平台、selectWeb,然后输入 Redirect URL as
https://login.microsoftonline.com/te/<tenant>/oauth2/authresp
,将 <tenant>
替换为 Azure AD B2C 租户的名称(比如"contosob2c.onmicrosoft.com").
- 在底栏中,select 保存。
然后您必须使用第 5 步中的应用程序机密通过 Azure AD B2C 门户创建策略密钥(例如 "AzureADClientSecret")。
然后您必须使用以下设置更新 Azure AD 技术配置文件:
<TechnicalProfile Id="AzureADAccountProfile">
<DisplayName>Log in with your work account</DisplayName>
<Protocol Name="OpenIdConnect"/>
<OutputTokenFormat>JWT</OutputTokenFormat>
<Metadata>
<Item Key="authorization_endpoint">https://login.microsoftonline.com/common/oauth2/v2.0/authorize</Item>
<Item Key="client_id"><!-- Enter the application ID from step 4 --></Item>
<Item Key="DiscoverMetadataByTokenIssuer">true</Item>
<Item Key="HttpBinding">POST</Item>
<Item Key="IdTokenAudience"><!-- Enter the application ID from step 4 --></Item>
<Item Key="response_types">id_token</Item>
<Item Key="scope">openid profile</Item>
<Item Key="UsePolicyInRedirectUri">false</Item>
<Item Key="ValidTokenIssuerPrefixes">https://login.microsoftonline.com/</Item>
</Metadata>
<CryptographicKeys>
<Key Id="client_secret" StorageReferenceId="B2C_1A_AzureADClientSecret"/>
</CryptographicKeys>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="enterpriseAuthentication" />
<OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="name" />
<OutputClaim ClaimTypeReferenceId="identityProvider" DefaultValue="tid" />
<OutputClaim ClaimTypeReferenceId="socialIdpUserId" PartnerClaimType="oid" />
...
</OutputClaims>
<OutputClaimsTransformations>
<OutputClaimsTransformation ReferenceId="CreateRandomUPNUserName"/>
<OutputClaimsTransformation ReferenceId="CreateUserPrincipalName"/>
<OutputClaimsTransformation ReferenceId="CreateAlternativeSecurityId"/>
</OutputClaimsTransformations>
<UseTechnicalProfileForSessionManagement ReferenceId="ReferenceId="SM-Noop" />
</TechnicalProfile>
我在关注这里的答案:
但是我无法登录,错误消息大致如下:
AADB2C: An exception has occured. Correlation ID: <GUID>. Timestamp: <Time>
此外,在最新的主控中查看演练时,整个页面已被删除,现在只包含 link 到 https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-setup-aad-custom,其中没有显示如何为多租户配置 ClaimsProvider Azure AD IDP。
错误消息不是很有用,我迷路了。
我的技术简介如下:
<ClaimsProvider>
<Domain>AzureAD</Domain>
<DisplayName>Login using Azure AD</DisplayName>
<TechnicalProfiles>
<TechnicalProfile Id="AzureADProfile">
<DisplayName>Azure AD</DisplayName>
<Description>Login with your Azure AD account</Description>
<Protocol Name="OpenIdConnect"/>
<OutputTokenFormat>JWT</OutputTokenFormat>
<Metadata>
<Item Key="DiscoverMetadataByTokenIssuer">true</Item>
<Item Key="ValidTokenIssuerPrefixes">https://login.microsoftonline.com/</Item>
<Item Key="authorization_endpoint">https://login.windows.net/common/oauth2/v2.0/authorize</Item>
<Item Key="client_id">MyAzureADB2CAppId</Item>
<Item Key="IdTokenAudience">MyAzureADB2CAppId</Item>
<Item Key="response_types">id_token</Item>
<Item Key="UsePolicyInRedirectUri">false</Item>
<Item Key="BearerTokenTransmissionMethod">AuthorizationHeader</Item>
<Item Key="scope">openid</Item>
<Item Key="HttpBinding">POST</Item>
</Metadata>
<CryptographicKeys>
<Key Id="client_secret" StorageReferenceId="B2C_1A_B2CSecret"/>
</CryptographicKeys>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="socialIdpUserId" PartnerClaimType="oid"/>
<OutputClaim ClaimTypeReferenceId="tenantId" PartnerClaimType="tid"/>
<OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="unique_name" />
<OutputClaim ClaimTypeReferenceId="givenName" PartnerClaimType="given_name" />
<OutputClaim ClaimTypeReferenceId="surName" PartnerClaimType="family_name" />
<OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="name" />
<OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="azureADAuthentication" />
<OutputClaim ClaimTypeReferenceId="identityProvider" DefaultValue="AzureAD" />
</OutputClaims>
<OutputClaimsTransformations>
<OutputClaimsTransformation ReferenceId="CreateRandomUPNUserName"/>
<OutputClaimsTransformation ReferenceId="CreateUserPrincipalName"/>
<OutputClaimsTransformation ReferenceId="CreateAlternativeSecurityId"/>
<OutputClaimsTransformation ReferenceId="CreateSubjectClaimFromAlternativeSecurityId"/>
</OutputClaimsTransformations>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop"/>
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>
编辑: 在按照 spottahhn 的建议引入 User Journey Recorder 之后,我设法得到了真正的错误:
The response received from the ClaimsProvider using TechnicalProfile
"<My_Azure_AD_Common_Profile>" in policy "<My_RP_Policy>" of tenant
"<My_B2C_Tenant>" did not contain an "id_token".
问题是:link将多租户 Azure AD 连接到 Azure AD B2C 是否仍然受支持,我如何配置才能使其正常工作?
将 Azure AD B2C 与 Azure AD 的公共端点联合时,您可以与以下任一集成:
- v1.0 端点:
https://login.microsoftonline.com/common/oauth2/authorize
- v2.0 端点:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
v1.0 端点
要将 Azure AD B2C 与 v1.0 端点集成,您必须通过 the Azure portal 向您的 Azure AD 租户注册 Azure AD B2C:
- 登录到 Azure 门户。
- 在顶部栏中,select 您的 Azure AD 目录。
- 在左侧栏中,select 所有服务 并找到 "App registrations".
- Select新申请注册.
- 在名称中输入一个应用程序名称,例如"Azure AD B2C".
- 在应用程序类型、select 网络应用/API.
- 在 Sign-on URL 中,输入
https://login.microsoftonline.com/te/<tenant>/oauth2/authresp
,将<tenant>
替换为您的 Azure AD B2C 的名称租户(例如"contosob2c.onmicrosoft.com")。 - Select 创建.
- 复制应用程序 ID 以备后用。
- Select 设置然后select键.
- 在密码部分,输入密码说明,select密码持续时间,select 保存 , 然后复制密码值以备后用。
然后您必须使用步骤 11 中的应用程序机密通过 Azure AD B2C 门户创建策略密钥(例如 "AzureADClientSecret")。
然后您必须使用以下设置更新 Azure AD 技术配置文件:
<TechnicalProfile Id="AzureADAccountProfile">
<DisplayName>Log in with your work account</DisplayName>
<Protocol Name="OpenIdConnect"/>
<OutputTokenFormat>JWT</OutputTokenFormat>
<Metadata>
<Item Key="authorization_endpoint">https://login.microsoftonline.com/common/oauth2/authorize</Item>
<Item Key="client_id"><!-- Enter the application ID from step 9 --></Item>
<Item Key="DiscoverMetadataByTokenIssuer">true</Item>
<Item Key="HttpBinding">POST</Item>
<Item Key="IdTokenAudience"><!-- Enter the application ID from step 9 --></Item>
<Item Key="response_types">id_token</Item>
<Item Key="scope">openid</Item>
<Item Key="UsePolicyInRedirectUri">false</Item>
<Item Key="ValidTokenIssuerPrefixes">https://sts.windows.net/</Item>
</Metadata>
<CryptographicKeys>
<Key Id="client_secret" StorageReferenceId="B2C_1A_AzureADClientSecret"/>
</CryptographicKeys>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="enterpriseAuthentication" />
<OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="name" />
<OutputClaim ClaimTypeReferenceId="identityProvider" DefaultValue="tid" />
<OutputClaim ClaimTypeReferenceId="socialIdpUserId" PartnerClaimType="oid" />
...
</OutputClaims>
<OutputClaimsTransformations>
<OutputClaimsTransformation ReferenceId="CreateRandomUPNUserName"/>
<OutputClaimsTransformation ReferenceId="CreateUserPrincipalName"/>
<OutputClaimsTransformation ReferenceId="CreateAlternativeSecurityId"/>
</OutputClaimsTransformations>
<UseTechnicalProfileForSessionManagement ReferenceId="ReferenceId="SM-Noop" />
</TechnicalProfile>
v2.0 端点
要将 Azure AD B2C 与 v2.0 端点集成,您必须通过 the Application Registration portal 向您的 Azure AD 租户注册 Azure AD B2C:
- 登录到应用程序注册门户。
- Select 添加应用.
- 在应用程序名称中,输入一个应用程序名称,例如"Azure AD B2C",然后select 创建 .
- 复制应用程序 ID 以备后用。
- 在 Application Secrets 部分,select 生成新密码 然后复制密码值以备后用。
- 在平台部分,select添加平台、selectWeb,然后输入 Redirect URL as
https://login.microsoftonline.com/te/<tenant>/oauth2/authresp
,将<tenant>
替换为 Azure AD B2C 租户的名称(比如"contosob2c.onmicrosoft.com"). - 在底栏中,select 保存。
然后您必须使用第 5 步中的应用程序机密通过 Azure AD B2C 门户创建策略密钥(例如 "AzureADClientSecret")。
然后您必须使用以下设置更新 Azure AD 技术配置文件:
<TechnicalProfile Id="AzureADAccountProfile">
<DisplayName>Log in with your work account</DisplayName>
<Protocol Name="OpenIdConnect"/>
<OutputTokenFormat>JWT</OutputTokenFormat>
<Metadata>
<Item Key="authorization_endpoint">https://login.microsoftonline.com/common/oauth2/v2.0/authorize</Item>
<Item Key="client_id"><!-- Enter the application ID from step 4 --></Item>
<Item Key="DiscoverMetadataByTokenIssuer">true</Item>
<Item Key="HttpBinding">POST</Item>
<Item Key="IdTokenAudience"><!-- Enter the application ID from step 4 --></Item>
<Item Key="response_types">id_token</Item>
<Item Key="scope">openid profile</Item>
<Item Key="UsePolicyInRedirectUri">false</Item>
<Item Key="ValidTokenIssuerPrefixes">https://login.microsoftonline.com/</Item>
</Metadata>
<CryptographicKeys>
<Key Id="client_secret" StorageReferenceId="B2C_1A_AzureADClientSecret"/>
</CryptographicKeys>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="enterpriseAuthentication" />
<OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="name" />
<OutputClaim ClaimTypeReferenceId="identityProvider" DefaultValue="tid" />
<OutputClaim ClaimTypeReferenceId="socialIdpUserId" PartnerClaimType="oid" />
...
</OutputClaims>
<OutputClaimsTransformations>
<OutputClaimsTransformation ReferenceId="CreateRandomUPNUserName"/>
<OutputClaimsTransformation ReferenceId="CreateUserPrincipalName"/>
<OutputClaimsTransformation ReferenceId="CreateAlternativeSecurityId"/>
</OutputClaimsTransformations>
<UseTechnicalProfileForSessionManagement ReferenceId="ReferenceId="SM-Noop" />
</TechnicalProfile>