Forum Discussion
How to recover or re-add device
I have been in the same boat sometime ago. Recycle bin is not yet supported and you can’t recover deleted devices, it’s a feature that MSFT working on.
All the devices stays on soft delete for 30 days, I know because when I delete a device from Azure AD, It stays in PowerBI report for 30 days.
Have you tried the ps below to add the device manually?
PS C:\>New-AzureADDevice -AccountEnabled $true -DisplayName "My new device" -DeviceId $guid -DeviceOSType "OS" -DeviceOSVersion "1.1"
https://feedback.azure.com/forums/169401-azure-active-directory/suggestions/32127307-recycle-bin-for-deleted-devices
I needed to use the "Remote" solution that you have mentioned here. I was remote from the concerned Laptop.
Your example helped me on the way, but had several questions on the Object details.
New-AzureADDevice -AccountEnabled $true -DisplayName "My new device" -DeviceId $guid -DeviceOSType "OS" -DeviceOSVersion "1.1"
For me, the hardest -Object (Like many others) was the mandatory -AlternativeSecurityIds $altsecids
So I added:
$key = [System.Text.Encoding]::Unicode.GetBytes("X509:<SHA1-TP-PUBKEY><Thumbprint>")
$altsecids = [PSCustomObject]@{key=$key;type='2'}
I also used OSType "Windows" and got a version number from another device. That did the trick and like magic the Laptop was able to login again via the original domein UserID. I'm not sure anymore where I have found all the pieces of this puzzle, but this worked form me.