Set up the local account identity provider
Before you begin, use the Choose a policy type selector to choose the type of policy you’re setting up. Azure Active Directory B2C offers two methods to define how users interact with your applications: through predefined user flows or through fully configurable custom policies. The steps required in this article are different for each method.
This article describes how to determine sign-in methods for your Azure AD B2C local accounts. A local account refers to an account that is created in your Azure AD B2C directory when a user signs up for your application or an admin creates the account. Usernames and passwords are stored locally and Azure AD B2C serves as the identity provider for local accounts.
Several sign-in methods are available for local accounts:
- Email: Users can sign up and sign in to your app with their email address and password. Email sign-up is enabled by default in your local account identity provider settings.
- Username: Users can sign up and sign in with a username and password.
- Phone (or "passwordless authentication"): Users can sign up and sign in to your app using a phone number as their primary sign-in identifier. They don't need to create passwords. One-time passwords are sent to your users via SMS text messages.
- Phone or email: Users can sign up or sign in by entering a phone number or an email address. Based on the user input, Azure AD B2C takes the user to the corresponding flow in the sign-up or sign-in page.
- Phone recovery: If you've enabled phone sign-up or sign-in, phone recovery lets users provide an email address that can be used to recover their account when they don't have their phone.
To learn more about these methods, see Sign-in options.
To configure settings for social or enterprise identities, where the identity of a user is managed by a federated identity provider like Facebook or Google, see Add an identity provider.
- Complete the steps in Get started with custom policies in Active Directory B2C
- Register a web application.
Configure local account identity provider settings
You can choose the local account sign-in methods (email, username, or phone number) you want to make available in your tenant by configuring the Local account provider in your list of Azure AD B2C Identity providers. Then when you set up a user flow, you can choose one of the local account sign-in methods you've enabled tenant-wide. You can select only one local account sign-in method for a user flow, but you can select a different option for each user flow.
To set your local account sign-in options at the tenant level:
Sign in to the Azure portal.
Make sure you're using the directory that contains your Azure AD B2C tenant. Select the Directories + subscriptions icon in the portal toolbar.
On the Portal settings | Directories + subscriptions page, find your Azure AD B2C directory in the Directory name list, and then select Switch.
Under Azure services, select Azure AD B2C. Or use the search box to find and select Azure AD B2C.
Under Manage, select Identity providers.
In the identity provider list, select Local account.
In the Configure local IDP page, select one or more identity types you want to enable for user flows in your Azure AD B2C tenant. Selecting an option here simply makes it available for use tenant-wide; when you create or modify a user flow, you'll be able to choose from the options you enable here.
- Phone: Users are prompted for a phone number, which is verified at sign-up and becomes their user ID.
- Username: Users can create their own unique user ID. An email address will be collected from the user and verified.
- Email: Users will be prompted for an email address which will be verified at sign-up and become their user ID.
Configure your user flow
- In the left menu of the Azure portal, select Azure AD B2C.
- Under Policies, select User flows.
- Select the user flow for which you'd like to configure the sign-up and sign-in experience.
- Select Identity providers
- Under the Local accounts, select one of the following: Email signup, User ID signup, Phone signup, Phone/Email signup, or None.
Enable the recovery email prompt
If you choose the Phone signup, Phone/Email signup option, enable the recovery email prompt.
- Sign in to the Azure portal.
- Make sure you're using the directory that contains your Azure AD B2C tenant. Select the Directories + subscriptions icon in the portal toolbar.
- On the Portal settings | Directories + subscriptions page, find your Azure AD B2C directory in the Directory name list, and then select Switch.
- In the Azure portal, search for and select Azure AD B2C.
- In Azure AD B2C, under Policies, select User flows.
- Select the user flow from the list.
- Under Settings, select Properties.
- Next to Enable recovery email prompt for phone number signup and sign in (preview), select:
- On to show the recovery email prompt during both sign-up and sign-in.
- Off to hide the recovery email prompt.
- Select Save.
Get the starter pack
Custom policies are a set of XML files you upload to your Azure AD B2C tenant to define user journeys. We provide starter packs with several pre-built policies. Download the relevant starter-pack:
- Email sign-in
- Username sign-in
- Phone sign-in. Select the SignUpOrSignInWithPhone.xml relying party policy.
- Phone or email sign-in. Select the SignUpOrSignInWithPhone.xml relying party policy.
After you download the starter pack.
In each file, replace the string
yourtenantwith the name of your Azure AD B2C tenant. For example, if the name of your B2C tenant is contosob2c, all instances of
Complete the steps in the Add application IDs to the custom policy section of Get started with custom policies in Azure Active Directory B2C. For example, update
Phone_Email_Base.xmlwith the Application (client) IDs of the two applications you registered when completing the prerequisites, IdentityExperienceFramework and ProxyIdentityExperienceFramework.
Upload the policy files