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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With