Hi,
Thanks for reaching out to Microsoft Q&A.
To ensure that your Azure Enterprise Application correctly provisions and recognizes custom claims in your cloud application, follow these steps:
- Configure the Claim in Azure AD:
- Navigate to the Azure portal and select your Enterprise Application.
- Under the "Single sign-on" section, go to "Attributes & Claims."
- Add a new claim named
name
and set its source attribute touser.userprincipalname
. - Apply the transformation
ExtractMailPrefix(user.userprincipalname)
to remove the domain portion, ensuring only the username is sent.
- Verify the Claim in the Token:
- Use a tool like jwt.ms to decode the token issued to your application.
- Confirm that the
name
claim is present and contains the expected value (i.e., the username without the domain).
- Update Your Application's JSON Transformation:
- Ensure that your application's JSON transformation logic correctly references the
name
claim. - If the claim is present in the token as
name
, your transformation should map it appropriately: "sourcePath": "$.name", "targetPath": "$.userName" - If the claim appears under a different key or within a nested structure, adjust the
sourcePath
accordingly.
- Ensure that your application's JSON transformation logic correctly references the
- Check for Predefined Claim Names:
- Some applications expect specific claim names.
- If your application doesn't recognize the name claim, consider mapping it to a claim name that your application expects, such as userName or preferred_username.
By following these steps, you can ensure that the name claim, transformed to exclude the domain, is correctly provisioned and recognized by your cloud application.
Please feel free to click the 'Upvote' (Thumbs-up) button and 'Accept as Answer'. This helps the community by allowing others with similar queries to easily find the solution.