Fetch users and groups from AAD Enterprise application...

Nitin S 6 Reputation points
2020-12-04T09:54:06.19+00:00

Hello,

I want to fetch list of all users and groups who have access to AAD enterprise application using
Microsoft Graph SDK in an console application.

Can any help me with the exact code.
Please see below details which needed to be fetched programatically.

45194-que.jpg

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,676 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. soumi-MSFT 11,716 Reputation points Microsoft Employee
    2020-12-04T10:16:58.32+00:00

    Hello @Nitin S , thank you for reaching out. To list all the users and groups that are already added to a specific application registered in Azure AD, you need to use the following Microsoft Graph API: https://graph.microsoft.com/beta/servicePrincipals/{id}/appRoleAssignedTo

    To use this API, make sure you have the following permissions added in your app registration using which you would make the Graph API call.
    45136-permissionsapproleassignedto.png

    More details about this API can be found here: https://learn.microsoft.com/en-us/graph/api/serviceprincipal-list-approleassignedto?view=graph-rest-1.0&tabs=http

    Hope this helps.

    Do let us know if this helps and if there are any more queries around this, please do let us know so that we can help you further. Also, please do not forget to accept the response as an Answer; if the above response helped in answering your query.

    2 people found this answer helpful.