Select-EntraGroupIdsContactIsMemberOf

Get groups in which a contact is a member.

Syntax

Select-EntraGroupIdsContactIsMemberOf
       -ObjectId <String>
      -GroupIdsForMembershipCheck <GroupIdsForMembershipCheck> 
      [<CommonParameters>]

Description

The Select-EntraGroupIdsContactIsMemberOf cmdlet gets groups in Microsoft Entra ID in which a contact is a member.

Examples

Example 1: Get groups in which a contact is a member

Connect-Entra -Scopes 'OrgContact.Read.All,Group.Read.All'
$Groups = New-Object Microsoft.Open.AzureAD.Model.GroupIdsForMembershipCheck
$Groups.GroupIds = (Get-EntraGroup -Filter "DisplayName eq 'Entra PowerShell Group'").ObjectId
$UserID = (Get-EntraContact -ObjectId 'hhhhhhhh-8888-9999-8888-cccccccccccc').ObjectId
Select-EntraGroupIdsContactIsMemberOf -ObjectId $UserID -GroupIdsForMembershipCheck $Groups

This example demonstrates how to get groups in which a contact is a member.

  • -ObjectId parameter specifies the contact Object ID.
  • -GroupIdsForMembershipCheck parameter specifies the group Object ID.

Parameters

-GroupIdsForMembershipCheck

Specifies an array of group object IDs.

Type:GroupIdsForMembershipCheck
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ObjectId

Specifies the object ID of a contact in Microsoft Entra ID.

Type:System.String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False