Fix “Connect-SPOService : Could not connect to SharePoint Online.” Error

Problem: When trying to connect o SharePoint Online using the Connect-SPOService cmdlet, got this error message, “Connect-SPOService : Could not connect to SharePoint Online.”

Connect-SPOService : Could not connect to SharePoint Online

Solutions:

1. Make sure the given tenant admin URL is correct, and your system is able to connect to the Tenant admin site! Just try to open the Tenant admin site: https://<your-tenant>-Admin.SharePoint.com in the web browser. (E.g. https://crescent-admin.sharepint.com or “https://TYPO-admin.sharepoint.com” would end up in error!)

2. If you are besides proxy server, add these two lines prior t connect SharePoint Online:

#Setup Proxy
$Credentials = [System.Net.CredentialCache]::DefaultCredentials
[System.Net.WebRequest]::DefaultWebProxy.Credentials = $Credentials

#Connect to SharePoint Online 
Connect-SPOService -url "https://crescentintranet-admin.sharepoint.com"

3. If you have access control enabled in SharePoint or Office 365 (E.g. “Allow only specific IPs”, Intune Policy, etc.), You won’t be able to connect to SharePoint Online when you are outside the access control rules.

4. If you get errors something like “Connect-SPOService : Could not authenticate to SharePoint Online http://crescentintranet-admin.sharepoint.com/ using OAuth 2.0”, that means the protocol you have provided for the tenant admin could be wrong! (E.g. “http://crescent-admin.sharepoint.com”, “”, etc.) It should be HTTPS instead of HTTP. Or the provided credentials are invalid.

Related post: Fix Connect-SPOService : The term ‘Connect-SPOService’ is not recognized as the name of a cmdlet, function, script file, or operable program

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply