Hello Quentin RODIC,
Microsoft Entra ID does not support emitting application roles in custom claims via claims mapping policies for client credentials flow.
Hence as a workaround check the below:
- Define appRoles in your API and assign them to the service principal of the calling app to use the standard roles claim.
- Map a JSON string of roles to a custom claim (still as a string) and store it in a directory extension property.
- By programmatically mapping roles and resolving the client app ID (azp), you can enhance roles inside your API.
App-only tokens do not support dynamic app role assertions through policy. If you need array format, use backend enrichment.
Hope this helps!
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful, which may help members with similar questions.
If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.