Forum Discussion

Aim Zaab's avatar
Aim Zaab
Brass Contributor
Oct 05, 2018

PowerShell cannot connect with stored credential when legacy auth is disabled

If I disable legacy auth, I don't seem to be able to connect to SharePoint with stored credentials.

 

Connect-SPOService -Url <adminUrl>-Credential $UserCredential

 

The cmdlet above is not working anymore as soon as I enable the CA policy to disable legacy auth.

 

Error: Connect-SPOService : The sign-in name or password does not match one in the Microsoft account system.

 

However I can still login to AzureAD and Teams.

 

https://techcommunity.microsoft.com/t5/Azure-Active-Directory-Identity/Azure-AD-Conditional-Access-support-for-blocking-legacy-auth-is/ba-p/245417

  • Using the -Credentials switch for the Connect-SPOService forces it to switch to legacy auth, thus you are getting blocked by the CA policy. You either need to use the interactive login, or configure client secret/cert if you want to do automation. Or exclude the account in question from the CA policy.

Resources