How do I resolve 401 Unauthorized error after deleting and recreating admin accounts in Office 365?

One migration that I was performing I had to recreate the Admin accounts and when I tried to resume the migration.  BAM.  this error occured.  MigrationWiz would not let me move forward unless I got thi figured out.  Turns out it was a simple fix, but due to a bug in Office 365.

Error: Your migration failed. Http POST request to’ failed – 401 Unauthorized.

From the great people at BitTitan – MigrationWiz Team.  Try this to fix the problem.

You may have performed these steps before migration:

  1. A new global admin Office 365 account was created.
  2. The global admin user was deleted.
  3. The user was recreated, with the same UPN.

Though you may be able to log in to this Office 365 account with the respective credentials, if this admin account is involved in the migration, perhaps you will get the 401 error due to a known Office 365 bug.

To fix this bug ,you have to use Windows PowerShell to manage Office 365. You first need to install the Office 365 commandlets. The steps for installing them are as follows:

Then, try these steps:

  1. Run Connect-MsolService and input Office 365 administrator account.
  2. Run Get-MsolUser -ReturnDeletedUsers –SearchString useralias | FL to get the user ObjectID.
  3. Run Remove-MsolUser –ObjectId xxxxx-xxxx-xxxx-xxxx-xxxxxxxxx  -RemoveFromRecycleBin to remove the old deleted user.
  4. Run Get-MsolUser –ReturnDeletedUsers to verify the deleted user account is removed
  5. The PowerShell window will prompt as follows:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

Up ↑