Remove-EntraDeletedDirectoryObject
Permanently delete a previously deleted directory object.
Syntax
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
, orHybrid 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.
Type: | System.String |
Aliases: | Id |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Inputs
System.String
Outputs
System.Object