magnify
Home Admin Office 365 Forcing a Delete for a User in Windows Azure Active Directory

Forcing a Delete for a User in Windows Azure Active Directory

Published on January 21, 2015 in Office 365

This should be done when the user is deleted in the local Active Directory but is still set to “synced with Active Directory” user in Windows Azure Active Directory and therefore cannot be deleted.

 

Delete All User Data

This command is used to remove a user from the Microsoft Online directory. This cmdlet will delete the user, their licenses, and any other associated data. From a computer with Windows Azure Active Directory PowerShell cmd capabilities,

  1. run the command connect-msolservice, enter the Office365 credentials.
  2. Run the command Remove-MsolUser –UserPrincipalName username@sjy.org.
    EXAMPLE: Remove-MsolUser –UserPrincipalName Smith@sjy.org
  3. Press Y to confirm the delete.

 

Delete Users from the Recycle Bin

When a user is deleted from the local Active Directory and the command successfully propagates to Windows Azure Active Directory, the account will remain in the Recycle Bin for 30 days. To remove a user permanently you have follow below steps.

  1. Run the command connect-msolservice, enter the Office365 credentials.
  2. Create a list of deleted users in the Recycle Bin by running the command Get-MsolUser –ReturnDeletedUsers | select UserPrincipalName, objectID. Note the ObjectID.
  3. Run the command Remove-MsolUser -RemoveFromRecycleBin –ObjectId [OBJECTID] where [OBJECTID] is the ObjectID provided.
    EXAMPLE: Remove-MsolUser -RemoveFromRecycleBin –ObjectId 452f811b-b26c-45f0-b988-1762358bb9b8
    To delete all users in the Recycle Bin, run the command Get-MsolUser -All -ReturnDeletedUsers | Remove-MsolUser -RemoveFromRecycleBin –Force
  4. Press Y to confirm the delete.

Print this entry