我正在尝试通过 powershell 脚本使用“应用密码”作为身份验证 MFA 方法连接到 azure AD。
这是我的脚本:
$username = 'user@example.com'
$Password = ConvertTo-SecureString 'MyPassword' -AsPlainText -Force
$creds = new-object System.Management.Automation.PSCredential($username, $password)
Connect-MsolService -Credential $creds
但是我收到了这个错误:
<块引用>Connect-MsolService:身份验证错误:身份验证意外失败