How to Remove 401 Unauthorized Error while Connecting with SharePoint Site / OneDrive?

While using Kernel Migration for SharePoint and trying to connect the SharePoint Site / OneDrive, you may face a special unauthorized error showing the error code 401.

Unauthorized Error 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 -

https://www.microsoft.com/en-in/download/details.aspx?id=35588

Click on the Download option and it will save the application at the default downloads folder.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 admin@contoso.com

Connect SPO Service with Basic Authentication

The login wizard will pop up where you require to input the details of Admin account.The login wizard will pop up

2.2 Modern Authentication - when you are connecting with Modern Authentication, then execute a new cmdlet –

Connect-SPOService -Url https://contoso-admin.sharepoint.com

Connect SPO Service with Modern Authentication

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

Disable Custom App Authentication

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.

Leave a reply