Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
Note
We Recommend that you configure Multi Factor Authentication for your instance. This will help enhance the security of the platform.
Step:1 Register an Azure AD app
To enable sign-in for users with an Azure AD account from a specific Azure AD organization, in Azure Active Directory B2C (Azure AD B2C), you need to create an application in Azure portal. For more information, see Register an application with the Microsoft identity platform.
Sign in to the Azure portal.
Make sure you're using the directory that contains your organizational Azure AD tenant (for example, contoso.com). Select the Directory + subscription filter in the top menu, and then choose the directory that contains your Azure AD 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 default 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-name is replaced with the name of your Azure AD B2C tenant.
https://your-B2C-tenant-name.b2clogin.com/your-B2C-tenant-name.onmicrosoft.com/oauth2/authresp
If you use a custom domain, enter
https://your-domain-name/your-tenant-name.onmicrosoft.com/oauth2/authresp
. Replace your-domain-name with your custom domain, and your-tenant-name with the name of your tenant.Select Register. Record the Application (client) ID for use in a later step.
Select Certificates & secrets, and then select New client secret.
Enter a Description for the secret, select an expiration, and then select Add. Record the Value of the secret for use in a later step.
Step 2: 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 firstAD.
For Metadata url, enter the following URL replacing {tenant} with the domain name of your Azure AD tenant:
https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration
For example:
https://login.microsoftonline.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration
https://login.microsoftonline.com/contoso.com/v2.0/.well-known/openid-configuration
For Client ID, enter the application ID that you previously recorded.
For Client secret, enter the client secret that you previously recorded.
For Scope, enter openid profile.
Leave the default values for Response type, and Response mode.
(Optional) For the Domain hint, enter contoso.com. For more information, see Set up direct sign-in using Azure Active Directory B2C.
Under Identity provider claims mapping, select the following claims(refer the below screenshot):
- User ID: sub
- Display name: name
- Given name: given_name
- Surname: family_name
- Email: preferred_username
Select Save.
Step 3: Add Azure AD identity provider to a user flow
At this point, the Azure AD identity provider has been set up, but it's not yet available in any of the sign-in pages. To add the Azure AD identity provider to a user flow:
- In your Azure AD B2C tenant, select User flows.
- Click the user flow that you want to add the Azure AD identity provider.
- Under the Social identity providers, for example select firstAD, refer the below screenshot.
- Select Save.
- To test your policy, select Run user flow.
- For Application, select a web application that you previously registered.
- Select the Run user flow button.
- From the sign-up or sign-in page, select Contoso Azure AD to sign in with Azure AD Contoso account.
If the sign-in process is successful, your browser is redirected to https://jwt.ms, which displays the contents of the token returned by Azure AD B2C.
Step 4: Restart the web application and try to sign in
Similarly, you can add one or more Azure AD(single tenant) to B2C to use those as social account. Once the configuration is successful, you will be able to find the AzureAD tenant as option of signing in to your MCT application.
Note
When you are adding more than one tenant, follow the “add custom homepage” document to add a custom homage and avoid any confusion while selecting the tenant.