Get-EntraContactMembership

Get a contact membership.

Syntax

Get-EntraContactMembership
   -OrgContactId <String>
   [-All]
   [-Top <Int32>]
   [-Property <String[]>]
   [<CommonParameters>]

Description

The Get-EntraContactMembership cmdlet gets a contact membership in Microsoft Entra ID.

This command is useful to administrators who need to understand which groups, roles, or administrative units a particular contact belongs to. This can be important for troubleshooting access issues, auditing memberships, and ensuring that contact memberships are correctly configured.

Examples

Example 1: Get the memberships of a contact

Connect-Entra -Scopes 'OrgContact.Read.All'
$Contact = Get-EntraContact -Filter "DisplayName eq 'Contoso Contact'"
Get-EntraContactMembership -OrgContactId $Contact.ObjectId

Id                                   DeletedDateTime
--                                   ---------------
ffffffff-5555-6666-7777-aaaaaaaaaaaa
aaaaaaaa-6666-7777-8888-bbbbbbbbbbbb
bbbbbbbb-7777-8888-9999-cccccccccccc

This command gets all the memberships for specified contact.

Example 2: Get all memberships of a contact

Connect-Entra -Scopes 'OrgContact.Read.All'
$Contact = Get-EntraContact -Filter "DisplayName eq 'Contoso Contact'"
Get-EntraContactMembership -OrgContactId $Contact.ObjectId -All

Id                                   DeletedDateTime
--                                   ---------------
ffffffff-5555-6666-7777-aaaaaaaaaaaa
aaaaaaaa-6666-7777-8888-bbbbbbbbbbbb
bbbbbbbb-7777-8888-9999-cccccccccccc

This command gets all the memberships for specified contact.

Example 3: Get top two memberships of a contact

Connect-Entra -Scopes 'OrgContact.Read.All'
$Contact = Get-EntraContact -Filter "DisplayName eq 'Contoso Contact'"
Get-EntraContactMembership -OrgContactId $Contact.ObjectId -Top 2

Id                                   DeletedDateTime
--                                   ---------------
ffffffff-5555-6666-7777-aaaaaaaaaaaa
aaaaaaaa-6666-7777-8888-bbbbbbbbbbbb

This command gets top two memberships for specified contact.

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

-OrgContactId

Specifies the ID of a contact 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