The request failed. The remote server returned an error: (401) Unauthorized.
Problem
During a migration to or from mailboxes (user, shared, or groups) in Exchange or Office 365, you receive the following error:
Fatal error during migration process: The request failed. The remote server returned an error: (401) Unauthorized.
Cause 1: During Mail Migration
Migration from/to Office365:
1- You are missing the required permission in your Azure AD Application.
Resolution
1- Make sure the required permissions are added to your Azure AD application. (the full_access_as_app permission in particular).
Please check this article to see how this permission can be added.
Migration from/to Exchange:
1- The username and passwords entered in the connector are incorrect.
2- The account is using MFA (Multi-Factor Authentication) to log in.
3- You’re using an SSO (Single Sign-On) System to log in.
4- Your migration account is unlicensed or does not have a valid license.
5- Your Legacy authentication is disabled. (This is only valid with Exchange on-prem deployments.)
Resolution
Connect to your Exchange server through a browser and try to log in with the administrator and password account defined in the connector.
1- If it doesn’t work, correct the credentials.
2- If it asks for a code or a phone number, please deactivate MFA for your migration service account.
3- If you’re using an SSO system, please deactivate it, and ensure that the migration service account authenticates directly to Office 365.
4- If the migration account is unlicensed, assign a valid Exchange License.
5- Enable Legacy authentication in your Exchange on-prem environment. Please refer to the documentation specific to your Exchange version and deployment to do this.
Cause 2: During File Migration
1- Incorrect username/password in your connector.
2- The migration account does not have access to the OneDrive of the user.
3- The application installed for the connector can’t access OneDrive user
Resolution
1 & 2- Connect to http://portal.office.com and try to log in with the administrator and password account defined in the connector.
If it doesn’t work, correct the credentials.
If your credentials are correct, try to access the OneDrive of the user. If you are hitting an error, please run the Preprocessing to give the Migration Account access to the User’s OneDrive
3- If you are using an automatically created connector, recreate the connector in order to reinstall the app.
If you are using a manually created connector, you have to add the certificate. For more details, follow this article.
Cause 3: During Site Migration – Credentials
The administrator and password entered in the source or target connector do not have enough permissions to access the particular SharePoint site collection you want to access.
Resolution
Connect to SharePoint central administration (eg: https://company-admin.sharepoint.com) and select the site collection. Then click on Owners -> Manage Administrators: Add your administrator or migration service account in the field Site Collection Administrators.
Cause 4: During Site Migration – Collection Creation
The target site collection is not created in the SharePoint central administration.
Please note: the site collection must be created prior to the site migration.
Resolution
Create the SharePoint site collection in the SharePoint central administration following these steps:
– Connect to SharePoint central administration (eg: https://company-admin.sharepoint.com)
– Under site collections, click on New -> Private Site Collection. Here you can create your site collection.
Once the site is created, you can relaunch the site migration using the newly-created site settings and information.