Today I was asked how to remove a registered Device from the Azure Active Directory, for all of those asking, what is a registered Device, see this Azure Article, and you can automate this step for your users, if you are following this Azure Article. But what if you would like to remove the registered Device of a User? You can do that through the Portal:
Or you can use PowerShell to do that!
To be able to remove Azure AD Devices, you must have installed the current Version of Microsoft Azure Active Directory Module for Windows PowerShell, which is currently 188.8.131.52 (Released at 15. August 2016), even it is a GA Version, you can find the download on the Connect Portal: Download Microsoft Azure Active Directory Module for Windows PowerShell
After the Installation you can search for a Device by using Get-MSOLDevice:
Get-MsolDevice -Name 'DESKTOP-RB004TR'
And you can delete a Device by using Remove-MsolDevice:
$devID = (Get-MsolDevice -Name 'DESKTOP-RB004TR').DeviceId
Remove-MSOLDevice -DeviceId $devID
Remove-MSOLDevice -DeviceId (Get-MsolDevice -Name 'DESKTOP-RB004TR').DeviceId
Without the Force switch, PowerShell will ask for confirmation before deletion:
One Word of caution: When you are searching for the string “Download Microsoft Azure Active Directory Module for Windows PowerShell” you will might find yourself on an Microsoft site which is translated, in my case it was german, and the last Update was from January 2016:
If you know how often things change in Azure, I would believe that this page is outdated in terms of information, but unfortunately, the page also directs you to an old Microsoft Azure Active Directory Module for Windows PowerShell where the cmdlets like Remove-MSOLDevice are missing. I gave feedback to Microsoft through the Webpage, hopefully they will update this page, and I think that other languages can be affected as well.