Define custom attributes for user flows
For each application, you might have different requirements for the information you want to collect during sign-up. Azure AD comes with a built-in set of information stored in attributes, such as Given Name, Surname, City, and Postal Code. With Azure AD, you can extend the set of attributes stored on a guest account when the external user signs up through a user flow.
You can create custom attributes in the Azure portal and use them in your self-service sign-up user flows. You can also read and write these attributes by using the Microsoft Graph API. Microsoft Graph API supports creating and updating a user with extension attributes. Extension attributes in the Graph API are named by using the convention
extension_<extensions-app-id>_attributename. For example:
<extensions-app-id> is specific to your tenant. To find this identifier, navigate to Azure Active Directory > App registrations > All applications. Search for the app that starts with "aad-extensions-app" and select it. On the app's Overview page, note the Application (client) ID.
Create a custom attribute
Sign in to the Azure portal as an Azure AD administrator.
Under Azure services, select Azure Active Directory.
In the left menu, select External Identities.
Select Custom user attributes. The available user attributes are listed.
To add an attribute, select Add.
In the Add an attribute pane, enter the following values:
- Name - Provide a name for the custom attribute (for example, "Shoe size").
- Data Type - Choose a data type (String, Boolean, or Int).
- Description - Optionally, enter a description of the custom attribute for internal use. This description isn't visible to the user.
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's used in any user flow, and not when you add it to the list of user attributes.
Once you've created a new user using a user flow that uses the newly created custom attribute, the object can be queried in Microsoft Graph Explorer. You should now see ShoeSize in the list of attributes collected during the sign-up journey on the user object. You can call the Graph API from your application to get the data from this attribute after it's added to the user object.