Microsoft Entra ID groups play a crucial role in managing user access permissions and security within an organization. IT administrators often require retrieving these groups to maintain proper access control and streamline identity management. While PowerShell commands like Get-MgGroup in Microsoft Graph can help fetch Microsoft Entra ID groups and their details, they call for extensive scripting and manual effort.
Altenatively, a tool like ManageEngine ADManager Plus can simply the process with a user-friendly, no-code interface. With built-in reports and management templates, administrators can effortlessly retrieve, manage, and keep an eye on their Microsoft Entra ID groups without writing any scripts.
Export reports in various formats, like PDF, XLS, CSV, and HTML.
Expand and export the graph.
Set up automated report generation.
Before running the Get-MgGroup cmdlet, ensure the following requirements are met:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Group.Read.All"
Use the Get-MgGroup cmdlet in Microsoft Graph PowerShell to retrieve Microsoft Entra ID groups. The syntax is as follows:
Get -MgGroup
[-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>]
Example 1: Get a group by its display name
Use this Graph PowerShell command to retrieve a Microsoft Entra ID group using its display name.
Get-MgGroup -Filter "DisplayName eq 'GroupName'"
Example 2: Get a list of all the groups
Use this Graph PowerShell command to retrieve a list of all the Microsoft Entra ID groups in your organization.
Get-MgGroup | Format-List Id, DisplayName, Description, GroupTypes
Example 3: Get a count of all groups
Use this Graph PowerShell command to retrieve a count of all the Microsoft Entra ID groups in your organization.
Get-MgGroup -ConsistencyLevel eventual -Count groupCount
The table below lists key parameters that can be used with the Get-MgGroup cmdlet to efficiently retrieve Microsoft Entra ID groups.
| Parameters | Description |
|---|---|
| -All | This lists all pages. |
| -ConsistencyLevel | This indicates the requested consistency level. |
| -CountVariable | This specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope. |
| -Search | This searches items by the search phrases. |
| -Filter | This filters the items by property values. |
| -GroupID | This is the unique identifier of a group. |