Edit

Share via


Select-EntraGroupIdsUserIsMemberOf

Selects the groups that a user is a member of.

Syntax

Default (Default)

Select-EntraGroupIdsUserIsMemberOf

    -UserId <String>
    -GroupIdsForMembershipCheck <GroupIdsForMembershipCheck>
    [<CommonParameters>]

Description

The Select-EntraGroupIdsUserIsMemberOf cmdlet selects the groups that a user is a member of in Microsoft Entra ID.

Examples

Example 1: Get the group membership of a group for a user

Connect-Entra -Scopes 'Application.Read.All'
$myGroup = Get-EntraGroup -Filter "DisplayName eq '<Group-DisplayName>'"
$UserId = 'SawyerM@contoso.com'
$groups = New-Object Microsoft.Open.AzureAD.Model.GroupIdsForMembershipCheck
$groups.GroupIds = $myGroup.Id
Select-EntraGroupIdsUserIsMemberOf -UserId 'SawyerM@contoso.com' -GroupIdsForMembershipCheck $groups
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb

This example retrieves the group membership of a group for a user.

  • -UserId parameter specifies the object Id of a user(as a UserPrincipalName or ObjectId).
  • -GroupIdsForMembershipCheck parameter specifies the group Object Ids.

Parameters

-GroupIdsForMembershipCheck

Specifies an array of group object IDs.

Parameter properties

Type:GroupIdsForMembershipCheck
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-UserId

Specifies the ID of a user (as a UserPrincipalName or ObjectId) in Microsoft Entra ID.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ObjectId

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.