IT admins are often tasked with finding the memberships of a user for compliance and audit purposes. While Graph PowerShell's Get-MgUserMemberOf command, an alternative to the Get-AzureADUserMembership command, can be used to obtain and export memberships of a user in Microsoft Entra ID, its complexity and non-intuitive interface make it a challenging option. On the other hand, ADManager Plus, a Microsoft 365 management and reporting tool, simplifies the process, allowing admins to quickly generate and export the membership reports of a user in just a few clicks.
Export reports in multiple formats, including HTML, CSV, and PDF.
Schedule automatic report generation.
Before using the Get-MgUserMemberOf cmdlet, ensure the following:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "User.Read.All","Group.ReadWrite.All","Directory.Read.All"
The Get-MgUserMemberOf cmdlet can be used in Microsoft Graph PowerShell to fetch a user's memberships in Microsoft Entra ID. Here's the syntax:
Get- MgUserMemberOf
-UserId <String>
[-ExpandProperty <String[]>]
[-Property <String[]>]
[-Filter <String>]
[-Search <String>]
[-Skip <Int32>]
[-Sort <String[]>]
[-Top <Int32>]
[-ConsistencyLevel <String>]
[-ResponseHeadersVariable <String>]
[-Headers <IDictionary>]
[-PageSize <Int32>]
[-All]
[-CountVariable <String>]
[-ProgressAction <ActionPreference>]
[<CommonParameters>]
Listing all the memberships of a particular user
Get-MgUserMemberOf -UserId <'user_id'> -All
In this command, replace user_id with the user's ID for whom you would like to list all the memberships.
The following table contains some parameters that can be used along with the Get-MgUserMemberOf command to fetch the memberships of a user in Microsoft Entra ID efficiently.
| Parameters | Description |
|---|---|
| -All | This parameter retrieves all memberships of a user without default pagination limits. |
| -UserId | This parameter retrieves memberships of a user based on their unique identifiers, such as user principal name or object ID. |
| -Property | This parameter retrieves specific attributes of the memberships of a user. |