Managing contact information in Microsoft Entra ID is essential for IT admins to maintain an organized and efficient directory. The Get-MgContact cmdlet in Microsoft Graph PowerShell enables admins to fetch Microsoft Entra ID contact objects along with their details, such as display names, email addresses, and organizational relationships. While this command is powerful, it requires scripting knowledge and manual execution, making it less accessible for admins who prefer a simpler approach. ManageEngine ADManager Plus simplifies contact report generation with its comprehensive reports.
Instantly assign managers to mail contacts.
Schedule and automate report generation.
Customize the report to include specific columns before exporting.
Before using the Get-MgContact cmdlet, ensure the following:
Install-Module Microsoft.Graph -Scope CurrentUser
Here's how you can use the Get-MgContact cmdlet to retrieve contact details from Microsoft Entra ID:
Get-MgContact
[-ExpandProperty <String[]>]
[-Property <String[]>]
[-Filter <String>]
[-Search <String>]
[-Skip <Int32>]
[-Sort <String[]>]
[-Top <Int32>]
[-ConsistencyLevel <String>]
[-ResponseHeadersVariable <String>]
[-Headers <IDictionary>]
[-PageSize <Int32>]
[-All]
[-CountVariable <String>]
[-ProgressAction <ActionPreference>]
[<CommonParameters>]
Example 1: Fetch a specific contact
Get-MgContact -ContactId "970"
Example 2: Get all Microsoft Entra ID contacts
Get-MgContact
Example 3: Retrieve specific contact attributes
Get-MgContact -ContactId "970" | Select-Object DisplayName, Mail, CompanyName
| Parameters | Description |
|---|---|
| -ContactId | This parameter allows you to specify the contact ID whose details you would like to retrieve. |
| -Filter | This parameter allows you to filter results based on contact attributes. |
| -All | This parameter lists all contacts in Microsoft Entra ID. |
| -OrgContactId | This parameter allows you to specify the unique identifier of an organizational contact whose details you would like to fetch. |