azure - Connect-MsolService:身份验证错误:意外的身份验证失败
问题描述
我正在尝试使用“应用程序密码”作为身份验证 MFA 方法通过 powershell 脚本连接到 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:身份验证错误:意外的身份验证失败
解决方案
不能在参数中输入密码,因为用户使用MFA登录,而不是用户名/密码,你应该让它弹出登录框并触发 MFA。
这里有一个类似的问题。
推荐阅读
- ruby-on-rails - Puma 100% 跑几秒后崩溃
- node.js - 无法在函数外更改 var 值
- python - 如何从 Django 中的发布请求中仅获取小时或分钟部分?
- google-bigquery - Bigquery - 如何计算两个连续行的总和
- r - 仅使用 R 基函数将一列一分为二
- github - Github Actions - 当分支中的特定目录获得更新时,如何触发推送?
- javascript - 我可以在没有捆绑器的情况下构建生产 JavaScript Web 应用程序吗?
- java - 从 pom.xml 中删除未使用的依赖项
- css - 关注带有 CSS 的输入隐藏标签
- javascript - 用户使用循环的无效输入