PowerShell Fails to Connect to Office 365

Issue

You may experience an error when connecting to SharePoint Online (or other Office 365 services) via PowerShell. All you get back is a generic:

Connect-SPOService : Unexpected response from the server. The content type of the response is “text/html;
charset=UTF8”. The status code is “OK”.

Example Error

PS C:\Windows\system32] Connect-SPOService -Url https://tenant-admin.sharepoint.com
Connect-SPOService : Unexpected response from the server. The content type of the response is "text/html;
charset=UTF8". The status code is "OK".
At line:1 char:1
+ Connect-SPOService -Url https://tenant-admin.sharepoint.com
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-SPOService], ClientRequestException
+ FullyQualifiedErrorId : Microsoft.SharePoint.Client.ClientRequestException,Microsoft.Online.SharePoint.PowerShel
l.ConnectSPOService

Cause

This can happen when your corporate web filter blocks the traffic to your admin URL, such as https://tenant-admin.sharepoint.com. Check the logs on the web filter / proxy to ensure the traffic is being allowed.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s