Connect-SPOService: The remote server returned an error: (400) Bad Request

Today I ran in a problem during connection to a customer Office 365 tenant. I tried to connect via PowerShell (7) with the standard cmdlet "Connect-SPOService". But after I entered my valid credentials 😉 and confirmed the two-factor validation the command ends with:
"The remote server returned an error: (400) Bad Request." 😒

Error message

In my script I imported the SharePoint Online PowerShell module with:

Import-Module Microsoft.Online.SharePoint.PowerShell

To solve the issue I had to append -UseWindowsPowerShell

Import-Module Microsoft.Online.SharePoint.PowerShell -UseWindowsPowerShell

After this change I was able to connect to the customer SharePoint Online tenant.

😊 Happy scripting ...


Kommentare

Beliebte Posts aus diesem Blog

Exchange Online: Schutzregel für E-Mail Weiterleitung

Vertikaler Bereich deaktiviert

Power Automate: Abrufen von SharePoint Listenelementen mit ODATA-Filter