Unauthorized when connecting to SharePoint Online

Today I wanted to connect with Windows PowerShell to one of our O365 test tenants. After typing in the SharePoint Tenant Admin user name and password I got this rather extensive error message:

[Error] ExecuteQuery threw following exception: Cannot contact web site ‘https://xxxxxxxxxxx-admin.sharepoint.com/’ or the web site does not support SharePoint Online credentials. The response status code is ‘Unauthorized’. The response headers are ‘X-SharePointHealthScore=1, X-MSDAVEXT_Error=917656; Access+denied.+Before+opening+files+in+this+location%2c+you+must+first+browse+to+the+web+site+and+select+the+option+to+login+automatically., SPRequestGuid=6b492b9e-f0bb-4000-89d1-94b300d84958, request-id=6b492b9e-f0bb-4000-89d1-94b300d84958, MS-CV=nitJa7vwAECJ0ZSzANhJWA.0, Strict-Transport-Security=max-age=31536000, X-FRAME-OPTIONS=SAMEORIGIN, SPRequestDuration=141, SPIisLatency=2, MicrosoftSharePointTeamServices=16.0.0.7101, X-Content-Type-Options=nosniff, X-MS-InvokeApp=1; RequireReadOnly, X-MSEdge-Ref=Ref A: 29A6FD752375435A9F23747D925B1DA9 Ref B: AMSEDGE0409 Ref C: 2017-11-09T20:12:49Z, Content-Length=0, Content-Type=text/plain; charset=utf-8, Date=Thu, 09 Nov 2017 20:12:49 GMT, P3P=CP=”ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI”, X-Powered-By=ASP.NET’.
[Warning] Connecting to site failed: Cannot contact web site ‘https://xxxxxxxxxxx-admin.sharepoint.com/’ or the web site does not support SharePoint Online credentials. The response status code is ‘Unauthorized’. The response headers are ‘X-SharePointHealthScore=1, X-MSDAVEXT_Error=917656; Access+denied.+Before+opening+files+in+this+location%2c+you+must+first+browse+to+the+web+site+and+select+the+option+to+login+automatically., SPRequestGuid=6b492b9e-f0bb-4000-89d1-94b300d84958, request-id=6b492b9e-f0bb-4000-89d1-94b300d84958, MS-CV=nitJa7vwAECJ0ZSzANhJWA.0, Strict-Transport-Security=max-age=31536000, X-FRAME-OPTIONS=SAMEORIGIN, SPRequestDuration=141, SPIisLatency=2, MicrosoftSharePointTeamServices=16.0.0.7101, X-Content-Type-Options=nosniff, X-MS-InvokeApp=1; RequireReadOnly, X-MSEdge-Ref=Ref A: 29A6FD752375435A9F23747D925B1DA9 Ref B: AMSEDGE0409 Ref C: 2017-11-09T20:12:49Z, Content-Length=0, Content-Type=text/plain; charset=utf-8, Date=Thu, 09 Nov 2017 20:12:49 GMT, P3P=CP=”ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI”, X-Powered-By=ASP.NET’.

Strange, because a week ago I was able to connect. During my search for a solution I came across this blogpost by Are Flyen. He describes a similar issue where he cannot connect to his SharePoint Online site through PowerShell.

I checked if the setting “LegacyAuthProtocolsEnabled” was disabled at our tenant. It was so I set it to $True. At the moment of writing this post the setting was not working yet.

Leave a Reply

Your email address will not be published. Required fields are marked *