I have a group in AzureAD that contains the service principals for a group of Azure ARC servers. I also have an App Registration for an API I own and have created an app role for it called Readers. I've assigned the group to the App role and have verified that in the Azure portal.
Now when I get a token from the Azure ARC identity endpoint for an individual service principal, the role does not appear as a claim in the token. I think this might be by design since the official docs say:
Currently, if you add a service principal to a group, and then assign an app role to that group, Azure AD doesn't add the roles claim to tokens it issues.
My questions is: How do I verify that the service principal has the correct role due to its group membership? Is there some workaround I can use?
I created an Azure AD Application and added App role like below:
Now, I created an Azure AD Group and added Service Principal as member:
Assigned App role to the Azure AD Group:
You can make use of below code to fetch the app roles assigned to the Service Principal:
The App role assigned to the Azure AD Application with the ID displayed successfully like below: