How to get a directory object by ID using Microsoft Graph PowerShell

The Get-MgDirectoryObjectById cmdlet retrieves detailed information about any Microsoft Entra ID (formerly Azure AD) directory object when you provide its unique object ID (GUID). This cmdlet works across multiple object types like users, groups, service principals, and applications, making it useful when you need to query specific objects without relying on names or filters. This article shows you three ways to get directory objects by ID:

  • ADManager Plus
  • PowerShell
 

Find directory objects by ID using ADManager Plus

ADManager Plus provides predefined reports that let you quickly locate directory objects by their ID:

  1. Navigate to Reports > Microsoft 365 > Azure Active Directory. Choose your preferred report category from the left pane and open a report.

    For example, to search for a user object, open the Microsoft 365 Users report (User Reports > General User Reports > Microsoft 365 Users).

  2. Click the search icon , enter the user's ID, and click Generate Now.
Finding Entra ID directory objects by ID using ADManager Plus

Get directory objects by ID using Microsoft Graph PowerShell

Prerequisites

You need the Microsoft Graph module installed and relevant directory read permissions:

Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Directory.Read.All"

Using the Get-MgDirectoryObjectById cmdlet

Replace <object-id> with directory object's unique ID to fetch it:

Get-MgDirectoryObjectById -Id

Find directory objects by ID using Entra admin center

The Microsoft Entra admin center allows quick searches for directory objects by name or ID under Users, Groups, or App registrations.

  1. Go to Microsoft Entra admin center.
  2. Search by entering the GUID in the relevant section (Users, Groups, or App registrations) for the object.

Examples

Example 1: Get user object by ID

Get-MgDirectoryObjectById -Id "12345678-90ab-cdef-1234-567890abcdef"

Example 2: Get group object

Get-MgDirectoryObjectById -Id "group-object-id"

Example 3: Retrieve application by ID

Get-MgDirectoryObjectById -Id "application-object-id"

Supported parameters

The following are some essential parameters that can be used along with the Get-MgDirectoryObjectById cmdlet:

Parameter Description
-Id The unique object ID of the directory object to retrieve.
-All Returns all results by paging.
-Select Specifies properties to include in the response.

Limitations of using native tools to get directory objects by ID

While powerful, relying solely on Microsoft Graph PowerShell and Entra ID admin center can present challenges:

  • PowerShell commands can get complex with different use cases and scenarios.
  • IT admins can spend a lot of time troubleshooting errors, which in turn negatively impacts productivity.
  • Delegation can get tricky since technicians require elevated permissions.
  • Search capabilities are limited to a few attributes or IDs.

How ADManager Plus helps you manage Microsoft Entra ID

ADManager Plus, an identity governance and administration solution with comprehensive Microsoft Entra ID management and reporting capabilities, simplifies complex admin tasks from a single, user-friendly console:

  • Search Entra ID directory objects using any attribute.
  • Manage Entra ID users, contacts, groups, licenses, and other objects with a script-free, centralized console.
  • Reduce human errors by automating user provisioning, deprovisioning, and license assignment across various platforms.
  • Delegate Entra ID tasks to technicians without elevating their native privileges.
  • Keep a watchful eye with 200+ prepackaged reports for your Entra ID and AD environments.
  • Monitor delegated activities through smart workflows.
  • Ensure business continuity with AD, Entra ID, and Google Workspace backup and recovery.

Perform script-free Microsoft Entra ID management and reporting with ADManager Plus

 
  • Find directory objects by ID using ADManager Plus
  • Get directory objects by ID using Microsoft Graph PowerShell
  • Find directory objects by ID using Entra admin center
  • Examples
  • Supported parameters
  • Limitations of using native tools to get directory objects by ID
  • How ADManager Plus helps you manage Microsoft Entra ID
The one-stop solution to Active Directory Management and Reporting
Email Download Link