๐ฅ Recipe ยท User & Group Management
List a User's Group Memberships in Entra ID via Microsoft Graph
Audit which security groups, Microsoft 365 groups, and directory roles a user belongs to
Complexity
Beginner
Impact
read-only + audit + access-review + low-risk
Context
Why This Matters
Knowing exactly which groups a user belongs to is foundational for access reviews, offboarding, troubleshooting permission issues, and license audits. In Entra ID (formerly Azure AD), a user's memberOf collection returns both group memberships (security groups, Microsoft 365 groups, distribution lists, dynamic groups) and directory role assignments in a single call.
Run this recipe when you need to:
- Investigate why a user has (or lacks) access to a resource
- Document group memberships before offboarding or role changes
- Identify unexpected privileged role assignments
- Verify dynamic group rules are assigning users correctly
- Support compliance or access-review requirements
Expected Outcomes
After completing this recipe you will have:
- A complete list of groups the target user belongs to, including display names, IDs, and descriptions
- Visibility into any directory role assignments (e.g., Global Administrator, User Administrator)
- A repeatable method โ GUI, API, or PowerShell โ for answering the same question for any user
- Optionally, an exportable CSV of memberships for reporting or audit evidence
Risks & Considerations
Things to watch for
- Direct vs transitive membership:
/memberOfreturns only direct memberships. Use/transitiveMemberOfto include nested group membership. - Mixed object types: The response contains both
#microsoft.graph.groupand#microsoft.graph.directoryRoleobjects. Filter by@odata.typeif you only want groups. - Null display names: Directory roles often return
nullfor displayName when using$select. Remove the$selector include it in the projection to get role names. - Permissions: Reading another user's memberships requires at minimum
GroupMember.Read.AllorDirectory.Read.All. - PII / least privilege: Group memberships can reveal organizational structure. Limit who can run these queries at scale.
Required Permissions
| Permission | Why It's Needed |
|---|---|
| User.Read.All | Read the target user object to resolve UPN or object ID |
| GroupMember.Read.All | Read the groups a user is a member of |
| Directory.Read.All | Alternative broader permission; also returns directory role assignments |
| RoleManagement.Read.Directory | Read directory role details when resolving role names |
The fastest way to get this done โ just ask Dex. Copy the prompt below and paste it into your Dex conversation.
For IT Admins
Paste into Dex CoAdmin
For End Users
How an employee would ask Dex for help