Wednesday, May 8, 2019

Hard deleting users

Hard deleting users

As mentioned earlier in this chapter, most user deletion operations move user accounts into the Azure Active Directory Recycle Bin rather than deleting those accounts entirely. Only after the user accounts have been stored in the recycle bin for a period of 30 days are they completely deleted. Once a user has been removed from the Azure Active Directory Recycle Bin, all licenses assigned to that user are reclaimed. Deleting a user so that their account ends up in the recycle bin is sometimes termed “soft deleting.”
You can view users that have been soft deleted using the following Windows PowerShellcommand:
Get-MsolUser -ReturnDeletedUsers
In some cases, you want to delete a user account entirely, bypassing the Azure Active Directory Recycle Bin. This is called a “hard delete.” You can hard delete a specific user as long as you know their UPN. To hard delete the user with the UPN don.funk@adatum346ER.onmicrosoft.com you would issue the following command:
Remove-MsolUser –UserPrincipalName don.funk@adatum346ER.onmicrosoft.com –Force
If you want to empty all users from the Azure Active Directory Recycle Bin, you can use the following command:
Get-MsolUser –ReturnDeletedUsers | Remove-MsolUser –RemoveFromRecycleBin -Force

More Info Remove-MsolUser
You can learn more about using Remove-MsolUser at: https://docs.microsoft.com/en-us/powershell/module/MSOnline/Restore-MsolUser.

No comments:

Post a Comment

Remote Hybrid and Office work