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'
$group = New-Object Microsoft.Open.AzureAD.Model.GroupIdsForMembershipCheck
$group.GroupIds = (Get-EntraGroup -Filter "displayName eq 'Sales and Marketing'").Id
$contact = Get-EntraContact -Filter "displayName eq 'Contoso Admin'"
Select-EntraGroupIdsContactIsMemberOf -ObjectId $contact.Id -GroupIdsForMembershipCheck $group

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