1
votes

A week ago I was able to access SharePoint Online programmatically through a c# application. Now I am getting the following error:

The remote server returned an error: (503) Server Unavailable.

I can access the SharePoint site in my browser completely fine.

I tried accessing it through SharePoint Online Management Shell but I get the same error when doing the following:

$adminUPN="[email protected]"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
Connect-SPOService -Url https://business.sharepoint.com/sites/bd/resume/ -Credential $userCredential

When I try and connect without the credentials using:

Connect-SPOService -Url https://business.sharepoint.com/sites/bd/resume/

It firstly pops up a Microsoft Sign in window to enter just my username/email, which looks normal. But when I enter my email, click next it takes me to different sign in page which looks off (See screenshot below, I removed company information with black scribble).

Password login

After I enter my password and hit enter I get a different error:

Connect-SPOService : Could not authenticate to SharePoint Online https://business.sharepoint.com/sites/bd/resume/ using OAuth 2.0

Firstly, I want to confirm if this is a problem on my end or if this a problem with permission, etc on the admin end.

1

1 Answers

1
votes

The cause for your issue could be the fact that the LegacyAuthProtocolsEnabled property, at tenant level, is set to False. Setting the value of this property to True can solve the issue.

To get the current value run the following command in PowerShell:

 Connect-SPOService

 Get-SPOTenant

To set the value to True for LegacyAuthProtocolsEnabled run the following commands in PowerShell:

 Connect-SPOService

 Set-SPOTenant -LegacyAuthProtocolsEnabled $True

After you run the commands it's necessary to wait some time until will work.

According to documentation, a value of False prevents Office clients using non-modern authentication protocols from accessing SharePoint Online resources.

A value of True- Enables Office clients using non-modern authentication protocols (such as, Forms-Based Authentication (FBA) or Identity Client Runtime Library (IDCRL)) to access SharePoint resources.