Get-EntraGroupMember
Gets a member of a group.
Syntax
Get-EntraGroupMember
-GroupId <String>
[-All]
[-Top <Int32>]
[-Property <String[]>]
[<CommonParameters>]
Description
The Get-EntraGroupMember
cmdlet gets a member of a group in Microsoft Entra ID. Specify the GroupId
parameter to get a member of a group.
In delegated scenarios, the signed-in user must have a supported Microsoft Entra role or a custom role with one of the following permissions: microsoft.directory/groups/members/read
, microsoft.directory/groups/members/limitedRead
, or microsoft.directory/groups/hiddenMembers/read
(for hidden members). The following least privileged roles support this operation:
- Group owners
- "Member" users
- "Guest" users (with limited read permissions)
- Directory Readers
- Directory Writers
- Groups Administrator
- User Administrator (includes hidden members)
- Exchange Administrator (includes hidden members)
- SharePoint Administrator (includes hidden members)
- Intune Administrator (includes hidden members)
- Teams Administrator (includes hidden members)
- Yammer Administrator (includes hidden members)
To list members of a hidden group, the Member.Read.Hidden
permission is also required.
Examples
Example 1: Retrieve and Select Group Member Properties
Connect-Entra -Scopes 'GroupMember.Read.All'
$group = Get-EntraGroup -Filter "DisplayName eq 'Sales and Marketing'"
Get-EntraGroup -GroupId $group.Id | Get-EntraGroupMember | Select-Object Id, DisplayName, '@odata.type'
Id DisplayName @odata.type
------------------------------------ ----------------- -------------------------------
dddddddd-3333-4444-5555-eeeeeeeeeeee Sawyer Miller #microsoft.graph.user
eeeeeeee-4444-5555-6666-ffffffffffff Alex Wilber #microsoft.graph.user
aaaaaaaa-6666-7777-8888-bbbbbbbbbbbb My Application #microsoft.graph.servicePrincipal
cccccccc-8888-9999-0000-dddddddddddd Contoso Group #microsoft.graph.group
This example retrieves the members of a specified group by its GroupId
and selects only the Id
, DisplayName
and @odata.type
properties for each member.
-GroupId
specifies the ID of a group.
Example 2: Get two group member
Connect-Entra -Scopes 'GroupMember.Read.All'
$group = Get-EntraGroup -Filter "DisplayName eq 'Sales and Marketing'"
Get-EntraGroupMember -GroupId $group.Id -Top 2
Id DeletedDateTime
-- ---------------
cccccccc-8888-9999-0000-dddddddddddd
dddddddd-9999-0000-1111-eeeeeeeeeeee
This example demonstrates how to retrieve top two groups from Microsoft Entra ID.
-GroupId
specifies the ID of a group.
Example 3: Get all members within a group by group ID
Connect-Entra -Scopes 'GroupMember.Read.All'
$group = Get-EntraGroup -Filter "DisplayName eq 'Sales and Marketing'"
Get-EntraGroupMember -GroupId $group.Id -All
Id DeletedDateTime
-- ---------------
dddddddd-3333-4444-5555-eeeeeeeeeeee
eeeeeeee-4444-5555-6666-ffffffffffff
aaaaaaaa-6666-7777-8888-bbbbbbbbbbbb
bbbbbbbb-7777-8888-9999-cccccccccccc
cccccccc-8888-9999-0000-dddddddddddd
This example retrieves all members within a group by group ID.
-GroupId
specifies the ID of a group.
Example 4: Get a group member by ID
Connect-Entra -Scopes 'GroupMember.Read.All'
$group = Get-EntraGroup -Filter "DisplayName eq 'Sales and Marketing'"
Get-EntraGroupMember -GroupId $group.Id
Id DeletedDateTime
-- ---------------
bbbbbbbb-7777-8888-9999-cccccccccccc
This example demonstrates how to retrieve group member by ID.
-GroupId
Specifies the ID of a group.
Parameters
-All
List all pages.
Type: | System.Management.Automation.SwitchParameter |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-GroupId
Specifies the ID of a group in Microsoft Entra ID.
Type: | System.String |
Aliases: | ObjectId |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Property
Specifies properties to be returned
Type: | System.String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Top
Specifies the maximum number of records to return.
Type: | System.Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |