Reputation: 21
I'm trying to connect to azure AD using "App Passwords" as authentication MFA method through powershell script.
this is my script:
$username = '[email protected]'
$Password = ConvertTo-SecureString 'MyPassword' -AsPlainText -Force
$creds = new-object System.Management.Automation.PSCredential($username, $password)
Connect-MsolService -Credential $creds
But I got this error:
Connect-MsolService : Authentication Error: Unexpected authentication failure
Upvotes: 2
Views: 15251
Reputation: 31
I had a similar issue. I ran the PowerShell below:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Connect-MsolService
Upvotes: 3
Reputation: 9549
You cannot put the password in the parameter, because the user logs in using MFA, not the username/password, you should let it pop up the login box and trigger MFA.
There is a similar problem here.
Upvotes: 0