Get-EntraDeletedDirectoryObject

Retrieves a soft deleted directory object from the directory.

Syntax

Get-EntraDeletedDirectoryObject
   -DirectoryObjectId <String>
   [-Property <String[]>]
   [<CommonParameters>]

Description

The Get-EntraDeletedDirectoryObject cmdlet retrieves a soft deleted directory object from the directory. Note that soft delete for groups is currently only implemented for Unified Groups (also known as Office 365 Groups).

Examples

Example 1: Retrieve a deleted directory object.

Connect-Entra -Scopes 'AdministrativeUnit.Read.All', 'Application.Read.All','Group.Read.All','User.Read.All'
Get-EntraDeletedDirectoryObject -DirectoryObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb'

Id                                   DeletedDateTime
--                                   ---------------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 2/2/2024 5:33:56 AM

This example shows how to retrieve the deleted directory object from the directory.

  • -DirectoryObjectId parameter specifies the Id of the directory object to retrieve.

Example 2: Retrieve a deleted directory object with more details.

Connect-Entra -Scopes 'AdministrativeUnit.Read.All', 'Application.Read.All','Group.Read.All','User.Read.All'
Get-EntraDeletedDirectoryObject -Id 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' | Format-Table -Property Id, displayName, '@odata.type' -AutoSize

Id                                   displayName           @odata.type
--                                   -----------           -----------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Entra PowerShell App #microsoft.graph.application

This example shows how to retrieve the deleted directory object details from the directory.

  • -Id parameter specifies the Id of the directory object to retrieve.

Parameters

-DirectoryObjectId

The Id of the directory object to retrieve.

Type:System.String
Aliases:Id
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

Outputs

System.Object