Get-EntraContact
Gets a contact from Microsoft Entra ID.
Syntax
Get-EntraContact
[-Filter <String>]
[-All]
[-Top <Int32>]
[-Property <String[]>]
[<CommonParameters>]
Get-EntraContact
-OrgContactId <String>
[-All]
[-Property <String[]>]
[<CommonParameters>]
Description
The Get-EntraContact
cmdlet gets a contact from Microsoft Entra ID.
Examples
Example 1: Retrieve all contact objects in the directory
Connect-Entra -Scopes 'OrgContact.Read.All'
Get-EntraContact
DisplayName Id Mail MailNickname
----------- -- ---- ------------
Contoso Contact aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb contact@contoso.com Contoso Contact
Contoso Contact1 bbbbbbbb-1111-2222-3333-cccccccccccc contact1@contoso.com Contoso Contact 1
Contoso Contact2 cccccccc-2222-3333-4444-dddddddddddd contact2@contoso.com Contoso Contact 2
Contoso Contact3 dddddddd-3333-4444-5555-eeeeeeeeeeee contact3@contoso.com Contoso Contact 3
This example retrieves all contact objects in the directory.
Example 2: Retrieve specific contact object in the directory
Connect-Entra -Scopes 'OrgContact.Read.All'
Get-EntraContact -OrgContactId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb'
DisplayName Id Mail MailNickname
----------- -- ---- ------------
Contoso Contact aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb contact@contoso.com Contoso Contact
This example retrieves specified contact in the directory.
-OrgContactId
parameter specifies the contact Id.
Example 3: Retrieve all contacts objects in the directory
Connect-Entra -Scopes 'OrgContact.Read.All'
Get-EntraContact -All
DisplayName Id Mail MailNickname
----------- -- ---- ------------
Contoso Contact aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb contact@contoso.com Contoso Contact
Contoso Contact1 bbbbbbbb-1111-2222-3333-cccccccccccc contact1@contoso.com Contoso Contact 1
Contoso Contact2 cccccccc-2222-3333-4444-dddddddddddd contact2@contoso.com Contoso Contact 2
Contoso Contact3 dddddddd-3333-4444-5555-eeeeeeeeeeee contact3@contoso.com Contoso Contact 3
This example retrieves all the contacts in the directory.
Example 4: Retrieve top two contacts objects in the directory
Connect-Entra -Scopes 'OrgContact.Read.All'
Get-EntraContact -Top 2
DisplayName Id Mail MailNickname
----------- -- ---- ------------
Contoso Contact aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb contact@contoso.com Contoso Contact
Contoso Contact1 bbbbbbbb-1111-2222-3333-cccccccccccc contact1@contoso.com Contoso Contact 1
This example retrieves top two contacts in the directory.
Example 5: Retrieve all contacts objects in the directory filter by DisplayName
Connect-Entra -Scopes 'OrgContact.Read.All'
Get-EntraContact -Filter "DisplayName eq 'Contoso Contact'"
DisplayName Id Mail MailNickname
----------- -- ---- ------------
Contoso Contact aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb contact@contoso.com Contoso Contact
Contoso Contact1 bbbbbbbb-1111-2222-3333-cccccccccccc contact1@contoso.com Contoso Contact 1
Contoso Contact2 cccccccc-2222-3333-4444-dddddddddddd contact2@contoso.com Contoso Contact 2
Contoso Contact3 dddddddd-3333-4444-5555-eeeeeeeeeeee contact3@contoso.com Contoso Contact 3
This example retrieves contacts having the specified display name.
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 |
-Filter
Specifies an OData v4.0 filter statement. This parameter controls which objects are returned.
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
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 |