Delete User from Office 365

Had an issue with a user that had been synced been deleted from AD but DirSync had been offline during the deletion and the user was still showing.

You can delete the user using the following PowerShell commands that need to be run in the Windows Azure Active Directory Module for Windows PowerShell:

$msolcred = get-credential 
connect-msolservice -credential $msolcred
Remove-MsolUser –UserPrincipalName user@domain.onmicrosoft.com

This should remove the user and then you can take it one step further by removing it from the recycle bin:

Remove-MsolUser –UserPrincipalName user@domain.onmicrosoft.com –RemoveFromRecycleBin

Be warned that the user cannot be recovered if it has been removed from the recycle bin.

Cheers

Paul

About the author