While using Kernel Migrator for SharePoint and trying to connect the SharePoint Site / OneDrive, you may face a special unauthorized error showing the error code 401.
Reason of the error
The SharePoint Administrator account does not have Roles permissions to access the user sites. You can assign the roles using SharePoint Online Management Shell.
1. Download the SharePoint Management Shell from the following link -
Click on the Download option and it will save the application at the default downloads folder.
2.1 Basic Authentication - when you are trying to connect through the Basic Authentication option (through user ID and password), then run the new cmdlet –
Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential email@example.com
The login wizard will pop up where you require to input the details of Admin account.
2.2 Modern Authentication - when you are connecting with Modern Authentication, then execute a new cmdlet –
Connect-SPOService -Url https://contoso-admin.sharepoint.com
The modern authentication will open the web browser page asking you to sign into the account.
3. Run the second cmdlet.
Set-SPOTenant -DisableCustomAppAuthentication $false
After executing the command, wait for at least 5 minutes to save the changes. After that, you can connect with your SharePoint account, and there will be no error 401.