Get-EntraDirectoryObject
Retrieves directory objects based on a list of IDs.
Syntax
Get-EntraDirectoryObject
-DirectoryObjectIds <System.Collections.Generic.List`1[String]>
[-ObjectTypes <System.Collections.Generic.List`1[String]>]
[-Property <String[]>]
[<CommonParameters>]
Description
The Get-EntraDirectoryObject
cmdlet retrieves directory objects based on a list of IDs (a list of up to 1000 GUIDs (as strings) to retrieve objects for).
Examples
Example 1: Get an object One or more object IDs
Connect-Entra -Scopes 'Directory.Read.All'
$groups = Get-EntraGroup -Limit 4
Get-EntraDirectoryObject -DirectoryObjectIds $groups.Id |
Select-Object Id, DisplayName, '@odata.type'
id displayName @odata.type
-- ----------- -----------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Adele Vance #microsoft.graph.user
bbbbbbbb-1111-2222-3333-cccccccccccc Contoso User #microsoft.graph.user
This example demonstrates how to retrieve objects for a specified object Ids.
DirectoryObjectIds
parameter specifies a list of up to 1000 GUIDs (as strings) to retrieve objects for.
Example 2: Get an object by types
Connect-Entra -Scopes 'Directory.Read.All'
Get-EntraDirectoryObject -DirectoryObjectIds 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb', 'bbbbbbbb-1111-2222-3333-cccccccccccc' -ObjectTypes 'User' |
Select-Object Id, DisplayName, '@odata.type'
id displayName @odata.type
-- ----------- -----------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Adele Vance #microsoft.graph.user
bbbbbbbb-1111-2222-3333-cccccccccccc Contoso User #microsoft.graph.user
This example demonstrates how to retrieve objects for a specified object type.
-DirectoryObjectIds
parameter specifies a list of up to 1000 GUIDs (as strings) to retrieve objects for.-ObjectTypes
parameter specifies the type of object ID.
Parameters
-DirectoryObjectIds
One or more object IDs's, separated by commas, for which the objects are retrieved. The IDs are GUIDs, represented as strings. You can specify up to 1,000 IDs.
Type: | System.Collections.Generic.List`1[System.String] |
Aliases: | ObjectIds |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ObjectTypes
Specifies the type of objects that the cmdlet returns. If not specified, the default is directoryObject, which includes all resource types defined in the directory. You can specify any object derived from directoryObject in the collection, such as user, group, and device objects.
Type: | System.Collections.Generic.List`1[System.String] |
Aliases: | Types |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Property
Specifies properties to be returned.
Type: | System.String[] |
Aliases: | Select |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
None
Outputs
System.Object