Define custom attributes in Azure Active Directory B2C
Every customer-facing application has unique requirements for the information that needs to be collected. Your Azure Active Directory (Azure AD) B2C tenant comes with a built-in set of information stored in attributes, such as Given Name, Surname, City, and Postal Code. With Azure AD B2C, you can extend the set of attributes stored on each customer account.
You can create custom attributes in the Azure portal and use them in your sign-up user flows, sign-up or sign-in user flows, or profile editing user flows. You can also read and write these attributes by using the Azure AD Graph API. Custom attributes in Azure AD B2C use Azure AD Graph API Directory Schema Extensions.
Support for newer Microsoft Graph API for querying Azure AD B2C tenant is still under development.
Create a custom attribute
Sign in to the Azure portal as the global administrator of your Azure AD B2C tenant.
Make sure you're using the directory that contains your Azure AD B2C tenant by switching to it in the top-right corner of the Azure portal. Select your subscription information, and then select Switch Directory.
Choose the directory that contains your tenant.
Choose All services in the top-left corner of the Azure portal, search for and select Azure AD B2C.
Select User attributes, and then select Add.
Provide a Name for the custom attribute (for example, "ShoeSize")
Choose a Data Type. Only String, Boolean, and Int are available.
Optionally, enter a Description for informational purposes.
The custom attribute is now available in the list of User attributes and for use in your user flows. A custom attribute is only created the first time it is used in any user flow, and not when you add it to the list of User attributes.
Use a custom attribute in your user flow
- In your Azure AD B2C tenant, select User flows.
- Select your policy (for example, "B2C_1_SignupSignin") to open it.
- Select User attributes and then select the custom attribute (for example, "ShoeSize"). Click Save.
- Select Application claims and then select the custom attribute.
- Click Save.
Once you have created a new user using a user flow which uses the newly created custom attribute, the object can be queried in Azure AD Graph Explorer. Alternatively you can use the Run user flow feature on the user flow to verify the customer experience. You should now see ShoeSize in the list of attributes collected during the sign-up journey, and see it in the token sent back to your application.
Send feedback about: