Errors when connecting to SharePoint Online Management Shell
Symptoms
When you try to connect to SharePoint Online Management Shell, you receive one of the following error messages:
The remote server returned an error: (429)
The response status code is 'Unauthorized'
Connection disconnected: Unexpected error occurred
No connection available
Connect-SPOService : Could not connect to SharePoint Online.
Resolution
Make sure that SharePoint Online Management Shell is up-to-date. For the steps to do this, see Getting started with SharePoint Online Management Shell.
Verify that you're using the latest TLS protocols. For more information, see the following articles:
Run PowerShell in administrative mode:
Select Start, and then enter powershell in the search box.
In the search results. look for Windows PowerShell or simply PowerShell (if you're using PowerShell Core).
Right-click Windows PowerShell (or PowerShell), and select Run as administrator.
After PowerShell is running in administrative mode, update the execution policy of the session by running the following command:
Set-ExecutionPolicy Undefined
Connect to the SharePoint Admin URL that you're using by running the following command:
Connect-SPOService -Url https://contoso-admin.sharepoint.com
Note: In this command, replace
https://contoso-admin.sharepoint.com
with the URL of the SharePoint site that you're administrating.
References
For more information about SharePoint Online Management Shell, see the following articles:
Still need help? Go to SharePoint Community.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for