Quantcast
Channel: Azure Active Directory forum
Viewing all articles
Browse latest Browse all 16000

Failed to connect to MSOLService using command line credentials

$
0
0

I use the following code to create a credential object then connect to MS Online services:

$password = ConvertTo-SecureString "XXXX" -AsPlainText -Force

$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist admin@mycompany.onmicrosoft.com, $password

$session = New-CsOnlineSession -Credential $cred

Import-PSSession $session -AllowClobber -verbose

Connect-MsolService -Credential $cred

This code has worked without issue for a while but running it today I got the following error:

Connect-MsolService : Authentication Error: Unexpected authentication failure.

When I remove the -Credential option from the Connect-MsolService command and use the interactive form, everything works fine (hence I know that the username and password are correct).

Any ideas?

Thanks



Simon


Viewing all articles
Browse latest Browse all 16000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>