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.”
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.