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 provides predefined reports that let you quickly locate directory objects by their ID:
For example, to search for a user object, open the Microsoft 365 Users report (User Reports > General User Reports > Microsoft 365 Users).
You need the Microsoft Graph module installed and relevant directory read permissions:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Directory.Read.All"
Replace <object-id> with directory object's unique ID to fetch it:
Get-MgDirectoryObjectById -Id
The Microsoft Entra admin center allows quick searches for directory objects by name or ID under Users, Groups, or App registrations.
Get-MgDirectoryObjectById -Id "12345678-90ab-cdef-1234-567890abcdef"
Get-MgDirectoryObjectById -Id "group-object-id"
Get-MgDirectoryObjectById -Id "application-object-id"
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. |
While powerful, relying solely on Microsoft Graph PowerShell and Entra ID admin center can present challenges:
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: