Resolving 401 Unauthorized Error - Admin Accounts in Microsoft 365

If you have been trying to migrate data into a Microsoft 365 account and have experienced this issue:

Your migration failed. Http POST request to' failed - 401 Unauthorized.

You may have performed these steps before migration:

  1. A new global admin Microsoft 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 Microsoft 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 Microsoft 365 bug.

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

Then, try these steps:

  1. Run Connect-MsolService and input Microsoft 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:


Now you can resubmit the failed migration.

Was this article helpful?
0 out of 17 found this helpful