Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use the graph API to get a listing of all Azure AD groups of which a user is a member?

I can't seem to find the API call to make to check to see if a user that has authenticated themselves is a member of a specific Azure AD group. Retrieving a list of all Azure AD groups the user is a member of would be fine as well. I assume this would be done through the Graph API but I can't seem to find the API I would use for this. How do I get a list of all Azure AD groups the currently authenticated user is a member of?

like image 681
GregH Avatar asked Oct 26 '25 07:10

GregH


1 Answers

The previous answer and comments mention using memberOf. However, in most cases you want to use transitiveMemberOf instead: https://learn.microsoft.com/en-us/graph/api/user-list-transitivememberof?view=graph-rest-1.0&tabs=http

memberOf only returns groups that the user is directly a member of whereas transitiveMemberOf respects group nesting. For example, if User is a member of GroupA and GroupA is a member of GroupB then memberOf will only return GroupA but transitiveMemberOf will return both GroupA and GroupB.

like image 162
Stephen Avatar answered Oct 29 '25 05:10

Stephen