Reputation: 1
I'm trying to get a List of all Members of an Azure AD Role with the Graph API. Users and Groups with that Role are displayed properly. But there should be a Service Principal with that Role as well, but i can't find it with the Graph API. Does anyone know why & maybe how to get the Serviceprincipal as well?
I tested both Endpoint-options: https://graph.microsoft.com/v1.0/directoryRoles/{ID}/members https://graph.microsoft.com/v1.0/directoryRoles/roleTemplateId={ID}/members"
The Setup in Azure Portal:
Upvotes: 0
Views: 419
Reputation: 4610
To get the service principal with that role you can make use of below Graph Api query:
GET https://graph.microsoft.com/v1.0/servicePrincipals/your service_principal_id/appRoleAssignedTo
Make sure to have below permissions before running the query :
Note: That only active assignments will be displayed in response when you ran the above query.
To know more in detail, you can refer this article List appRoleAssignments granted for a service principal - Microsoft Graph v1.0 .
Upvotes: 0