Hi @Abhay Chandramouli • Thank you for reaching out. Please find my comments inline:
1. Can we change the name of the attribute ? I don't want it to have extenstions_<tenantId>_name format?
No, all the extension attributes are stored in the standard Azure AD or Azure AD B2C directories as extenstions_<app_id_of_b2c_extension_app>_name
format and this format is not customizable.
2. If the answer to Q1 is no, can we assign this attribute to another field in the token ? say I have extentsion_tenantId_name and in the token or application claims I want it's value to be stored as username ?
Yes, you can use Custom Policy to pass the custom attribute as a claim with any name within the token. Keep in mind that the claim name must not be already in use and is not a restricted claim. This option is not yet available in User flows.
Additional Details:
Below is how you define a claim in the custom policy:
<ClaimType Id="extension_gender">
<DisplayName>Type your gender</DisplayName>
<DataType>string</DataType>
<UserInputType>TextBox</UserInputType>
</ClaimType>
This claim will be stored in the directory as:
`extenstions_<app_id_of_b2c_extension_app>_gender`
To pass the claim as gender in the token, you need to add the below output claim in your RP file, e.g. SignupOrSignin.xml or ProfileEdit.xml. The PartnerClaimType
parameter is used to specify what name to be used for the claim in the token sent to the application.
<OutputClaim ClaimTypeReferenceId="extension_gender" PartnerClaimType="gender" />
You can also define PartnerClaimType
when you define the claim as mentioned in the first xml snippet of ClaimsSchema document.
-----------------------------------------------------------------------------------------------------------
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.