Edit

Share via


Remove-EntraDeletedDirectoryObject

Permanently delete a previously deleted directory object.

Syntax

Default (Default)

Remove-EntraDeletedDirectoryObject

    -DirectoryObjectId <String>
    [<CommonParameters>]

Description

The Remove-EntraDeletedDirectoryObject cmdlet is used to permanently delete a previously deleted directory object.

When a directory object is permanently deleted, it can no longer be restored.

For delegated scenarios, the calling user needs to have at least one of the following Microsoft Entra roles.

  • To permanently delete deleted applications or service principals: Application Administrator, Cloud Application Administrator, or Hybrid Identity Administrator.
  • To permanently delete deleted users: User Administrator.
  • To permanently delete deleted groups: Groups Administrator.

Examples

Example 1: Delete a previously deleted directory object

Connect-Entra -Scopes 'Application.ReadWrite.All','Group.ReadWrite.All','Application.ReadWrite.All','User.ReadWrite.All'
$deletedApplication = Get-EntraDeletedApplication -SearchString 'My PowerShell Application'
Remove-EntraDeletedDirectoryObject -DirectoryObjectId $deletedApplication.Id

This example demonstrates how to permanently delete a previously deleted directory object by DirectoryObjectId.

  • -DirectoryObjectId parameter specifies the Id of the directory object that is permanently deleted.

Parameters

-DirectoryObjectId

The DirectoryObjectId of the directory object that is permanently deleted.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Id

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

System.String

Outputs

System.Object