How to restore devices deleted in Microsoft Entra

restore soft deleted devices in Microsoft Entra

Back in 2025, I wrote an article about potential upcoming soft-delete capabilities for devices in Microsoft Entra. Back then, the soft-delete capability for devices had not been announced. However, in the last few days, as of the time of writing this post, my Microsoft Documentation Tracker picked up that enabling soft-delete for Microsoft Entra Device objects was released in public preview.

Why is this needed?

Devices are often removed from Entra for many reasons, maybe through automated device clean-up scripts, maybe accidentally by an administrator, sometimes due to migrations, or even while troubleshooting technical issues.

Historically, this deletion was permanent and destructive. If a machine was deleted by mistake, it would have to be reregistered someway again.

The soft-delete capability for devices is essential a safety net. You accidentally delete a device? before having to find the device and repair its connection to Entra, you can simply restore it. Also crucially, it prevents BitLocker keys from being purged along-side the device object.

View soft-deleted devices

Viewing which devices have been deleted in Microsoft Entra can either be done directly through the Microsoft Entra web portal, or using Microsoft Graph programmatically. The direct URL for the deleted devices blade is:

https://entra.microsoft.com/#view/Microsoft_AAD_Devices/DeletedDevices.reactview

Otherwise, you can navigate to the Devices section of Microsoft Entra and select it from the sub menu. From here, you will see all devices which have been soft deleted and are available for restoring.

Deleted Devices blade in Entra
Deleted Devices blade in Entra

To programmatically list all deleted devices using Microsoft Graph PowerShell, you can use the below example commands:

Connect-MgGraph -Scopes Directory.Read.All
$uri = "/beta/directory/deletedItems/microsoft.graph.device"
$Devices = Invoke-MgGraphRequest -Uri $uri -Method GET -OutputType PSObject | Select -Expand Value 
$Devices | select displayName | ft

Restore soft-deleted devices

To restore a device, simply select it from the list and click Restore devices. When you refresh the list the device will no longer be there, but back in the active devices list.

Restore deleted devices in Microsoft Entra
Restore deleted devices in Microsoft Entra

Restoring the device using Microsoft Graph PowerShell is very simple too. All you need is the Id of the device and to connect with the necessary permissions. As of the time of writing this, the least privileged permission is Device.ReadWrite.All, but soon a fine grained permissions should be released like Device.DeleteRestore.All.

Connect-MgGraph -Scopes Device.ReadWrite.All
$uri = "/beta/directory/deletedItems/microsoft.graph.device/$id/restore"
Invoke-MgGraphRequest -Uri $uri -Method POST -OutputType PSObject

Microsoft Entra Deleted Devices Limitations FAQ

Q: Are custom role-based access control (RBAC) roles supported for device restoration?

  • A: No, custom RBAC roles cannot be used for device soft-delete or restore operations during the preview. Restoration requires specific built-in roles: Cloud Device Administrator, Intune Administrator, or Global Administrator.

Q: Can device owners recover their own devices if they accidentally delete them?

  • A: No. A device owner (the user who joined or registered the device) is permitted to soft delete their own device, but they lack the permissions to restore it or permanently delete it.

Q: Can I register a new device using the same ID as a deleted device?

  • A: The deviceId uniqueness is strictly enforced across both the Entra directory and the soft-deleted containers. The deviceId of a soft-deleted device remains reserved, meaning a new device cannot be registered with that same ID until the old device is either fully restored or permanently hard-deleted.

Q: What happens if a device is left in the soft-deleted state?

  • A: Soft-deleted devices are kept in a suspended state for a maximum of 30 days. After 30 days, they are automatically and permanently hard-deleted. Once hard deletion occurs, all associated data, including BitLocker recovery keys and LAPS passwords, is permanently unrecoverable and the device object must be fully recreated.

Q: What is the operational state of a device while it is soft-deleted?

  • A: The device cannot authenticate or access any cloud resources protected by Entra ID. The device object is hidden from Intune and active device lists, and it cannot be modified by management tools.

Daniel Bradley

Daniel Bradley is a UK-based technical architect and Microsoft MVP in Security. He specialises in Microsoft Entra, Intune, and Microsoft Graph PowerShell and is the author of Microsoft Graph PowerShell for Administrators. He writes and edits Our Cloud Network using experience gained from working with Microsoft cloud environments.

Leave a Reply