หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
The user attributes you collect during sign-up are stored with the user's profile in your directory. You can choose from built-in user attributes or create custom user attributes.
Applies to external tenants: Feature support varies by authentication approach and API or SDK version. Compare Microsoft-hosted authentication, Embedded native authentication, and Bring Your Own UX (BYO UX) in the authentication approach overview. Check feature availability in the authentication support matrix.
Page layout and input-control settings in this article apply to Microsoft-hosted authentication. For the Native Authentication API integrations, use the attribute collection contract.
Built-in user attributes, such as city, country/region, and email address, are available in Microsoft Entra External ID. Choose the attributes your app needs during sign-up.
For any additional information you want to collect, you can create custom user attributes. Several custom input controls can be added to the sign-up page to collect the attributes, including text boxes, radio buttons, and check boxes. The following example shows custom input controls for a loyalty number, consent to terms of use, and privacy policy consent.
Built-in user attributes
Microsoft Entra External ID has built-in user attributes you can collect during sign-up. You configure these attributes when you create user flows in the Microsoft Entra admin center.
This table summarizes the built-in user attributes you can collect during the sign-up flow:
- Label in Microsoft Entra admin center is the name of the user attribute as it appears in the Microsoft Entra admin center.
- Programmable name is the name of the user attribute as used in the user resource of the Microsoft Graph API. For authentication-specific fields, see the native authentication attribute contract.
- Data type is the user attribute's data type.
| Label in Microsoft Entra admin center | Programmable name | Data type | Remarks |
|---|---|---|---|
| City | city | String | Maximum length is 128 characters. |
| Country/Region | country | String | Maximum length is 128 characters. |
| Display Name | displayName | String | Maximum length is 256 characters. |
| Email Address | String | This property can't contain accent characters. For API field names, follow the returned attributeId in the native authentication attribute contract. V1 uses username for the email identifier. |
|
| Given Name | givenName | String | Maximum length is 64 characters. |
| Job Title | jobTitle | String | Maximum length is 128 characters. |
| Postal Code | postalCode | String | Maximum length is 40 characters. |
| State/Province | state | String | Maximum length is 128 characters. |
| Street Address | streetAddress | String | Maximum length is 1024 characters. |
| Surname | surname | String | Maximum length is 64 characters. |
Custom user attributes
If your app requires more information than the built-in user attributes provide, you can add your own attributes. These are called custom user attributes.
To define a custom user attribute, create it at the tenant level so it can be used in any user flow in the tenant. Then assign it to your sign-up user flow. Microsoft-hosted page layout settings control how it appears on Microsoft-hosted pages; your app or self-hosted website controls its own presentation.
For instructions, see Create custom user attributes.
Custom user attributes input types
The following input controls describe Microsoft-hosted page layouts. With Embedded native authentication or BYO UX, use the descriptors returned by the Native Authentication API to build your interface.
Before you use custom user attributes, choose the input control for each attribute:
- String text box.
- Radio buttons.
- Multiselect checkboxes.
- Numeric text box.
- Single-select checkbox.
Refer to this table to find the appropriate data types and user input types:
| Data type | User input type | Description |
|---|---|---|
| String | TextBox | Free-form text entry field. |
| String | RadioSingleSelect | Series of radio buttons with only one selection allowed. The Text for individual radio buttons can include hyperlinks formatted in Markdown language. |
| String | CheckboxMultiSelect | Series of one or more checkboxes with multiple selections allowed. The Text for individual checkboxes can include hyperlinks formatted in Markdown language. |
| Boolean | CheckboxSingleSelect | Single boolean checkbox with a label. The Label for the checkbox can include hyperlinks formatted in Markdown language. |
| Int | NumericTextBox | Free-form integer entry. |
Checkboxes and radio buttons can include hyperlinks to other content, such as terms of use and privacy policies. The example at the beginning of this article shows a sign-up page that combines built-in attributes and custom attributes. In the example:
- The Display Name field is a built-in attribute.
- The Loyalty Number is a custom attribute with a free-form entry field that accepts a numeric integer. You can configure this format using the Int data type and NumericTextBox user input type.
- The terms of use and privacy policy custom attributes are separate, single-select checkboxes with labels containing hyperlinks. You can configure a single checkbox using the Boolean data type, which defaults to the CheckboxSingleSelect user input type. Use Markdown language to add hyperlinks to the checkbox label.
To configure attribute input controls, see Configure the user input types.
Where custom user attributes are stored
Custom user attributes are also known as directory extension attributes because they extend the user profile information stored in your directory. All extension attributes for your external tenant are stored in an app named b2c-extensions-app. After a user enters a value for the custom attribute during sign-up, it's added to the user object and can be called via the Microsoft Graph API using the naming convention extension_{appId-without-hyphens}_{custom-attribute-name} where:
{appId-without-hyphens}is the stripped version of the client ID for the b2c-extensions-app.{custom-attribute-name}is the name you assigned to the custom attribute.
For example, if the client ID of the b2c-extensions-app is 00001111-aaaa-2222-bbbb-3333cccc4444 and the attribute name is:
- loyaltyNumber, then the custom attribute is named
extension_00001111aaaa2222bbbb3333cccc4444_loyaltyNumber. - Loyalty Number, then the custom attribute is named
extension_00001111aaaa2222bbbb3333cccc4444_LoyaltyNumber. You remove the space and use camel case to separate the words.
Use the Find the application ID for the extensions app article to learn how to find the application ID for the b2c-extensions-app registered in your external tenant.
Attribute collection in your interface
For Embedded native authentication and BYO UX, follow the native authentication attribute contract. Use exact returned attributeId values, current requirements, and validation metadata rather than copying the directory property table into a request. Native Authentication API submissions use string values even when the directory attribute has a Boolean or integer data type.
For an existing V1 SDK integration, use the MSAL Android library for library-specific attribute types. Those types aren't the response schema for the Native Authentication API.
Microsoft Graph APIs
User attributes are referred to as user flow attributes in Microsoft Graph. Use the identityUserFlowAttribute resource type and its associated methods to manage both built-in and custom user flow attributes.
These management APIs have their own permission and resource-token requirements. Signing in through the Native Authentication API doesn't grant directory-management access.