Set up sign-in for a specific Azure Active Directory organization in Azure Active Directory B2C
To use an Azure Active Directory (Azure AD) as an identity provider in Azure AD B2C, you need to create an application that represents it. This article shows you how to enable sign-in for users from a specific Azure AD organization using a user flow in Azure AD B2C.
Create an Azure AD app
To enable sign-in for users from a specific Azure AD organization, you need to register an application within the organizational Azure AD tenant, which is not the same as your Azure AD B2C tenant.
Sign in to the Azure portal.
Make sure you're using the directory that contains your Azure AD tenant. Select the Directory + subscription filter in the top menu and choose the directory that contains your Azure AD tenant. This is not the same tenant as your Azure AD B2C tenant.
Choose All services in the top-left corner of the Azure portal, and then search for and select App registrations.
Select New registration.
Enter a name for your application. For example,
Azure AD B2C App.
Accept the selection of Accounts in this organizational directory only for this application.
For the Redirect URI, accept the value of Web, and enter the following URL in all lowercase letters, where
your-B2C-tenant-nameis replaced with the name of your Azure AD B2C tenant. For example,
All URLs should now be using b2clogin.com.
Click Register. Copy the Application (client) ID to be used later.
Select Certificates & secrets in the application menu, and then select New client secret.
Enter a name for the client secret. For example,
Azure AD B2C App Secret.
Select the expiration period. For this application, accept the selection of In 1 year.
Select Add and copy the value of the new client secret that is displayed to be used later.
Configure Azure AD as an identity provider
Make sure you're using the directory that contains Azure AD B2C tenant. Select the Directory + subscription filter in the top menu and choose the directory that contains your Azure AD B2C tenant.
Choose All services in the top-left corner of the Azure portal, and then search for and select Azure AD B2C.
Select Identity providers, and then select New OpenID Connect provider.
Enter a Name. For example, enter Contoso Azure AD.
For Metadata url, enter the following URL replacing
your-AD-tenant-domainwith the domain name of your Azure AD tenant:
Do not use the Azure AD v2.0 metadata endpoint, for example
https://login.microsoftonline.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration. Doing so results in an error similar to
AADB2C: A claim with id 'UserId' was not found, which is required by ClaimsTransformation 'CreateAlternativeSecurityId' with id 'CreateAlternativeSecurityId' in policy 'B2C_1_SignUpOrIn' of tenant 'contoso.onmicrosoft.com'when attempting to sign in.
For Client ID, enter the application ID that you previously recorded.
For Client secret, enter the client secret that you previously recorded.
Leave the default values for Scope, Response type, and Response mode.
(Optional) Enter a value for Domain_hint. For example, ContosoAD. This is the value to use when referring to this identity provider using domain_hint in the request.
Under Identity provider claims mapping, enter the following claims mapping values:
- User ID: oid
- Display name: name
- Given name: given_name
- Surname: family_name
- Email: unique_name