azure - 使用 MFA 登录 Azure CLI

标签 azure command-line-interface multi-factor-authentication

安装在 Windows(和 Linux?)操作系统上的 Azure CLI 显然使用设备代码授权流程来登录用户。鉴于此类用户可能需要使用多重 (MFA) 身份验证来执行管理任务,如何使用 Azure AD 作为身份提供程序来为此用例(CLI 登录、强制执行 MFA)实现 MFA?

我的理解是,Azure 登录 CLI 的实现使用浏览器进行初始身份验证 - 这样做是为了让用户不会在 CLI 内输入登录密码。

最佳答案

My understanding is that Azure's implementation of the login to a CLI uses the browser for the initial authentication - and this was done so that the user doesn't type in login secrets inside the CLI.

是的,默认情况下,在 Azure 中,当您尝试通过 cli 登录时,它会启动浏览器 session 来输入您的凭据并进行进一步的日志记录。

如果您想在使用 CLI 登录门户时启用 MFA,则必须在事件目录中为每个用户启用 MFA,如下所示。

enter image description here

如果您想确保每个尝试通过 Azure CLI 登录的用户都必须使用多重身份验证,那么您可以通过创建 conditional access policy 来实现此目的.

我们已经在我们的环境中对此进行了测试,通过在 AAD 中创建用户并启用每个用户的 MFA,它工作正常。

您可以引用以下示例输出以供引用:

enter image description here

关于azure - 使用 MFA 登录 Azure CLI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69921031/

相关文章:

使用条件访问策略的 Azure Active Directory 多重身份验证不起作用

azure - 如何从docker注册表中提取容器镜像来部署azure容器

azure - 应用服务无法通过 VPN 连接连接到资源

Azure 应用服务 - 如何阻止端口 8172 上的 MsDeploy.axd

azure - 我需要将 Firebase 连接到 Azure 通知中心吗?

kubernetes - 如何运行 Kubernetes pod,其唯一目的是对其运行 exec?

go - 全局变量不会从 CLI 命令中保留下来

Heroku 更新说我没有工具带

与 MFA 提示相关的 Azure AD SAML 不一致

Azure 事件目录 B2C : Use conditional User Flow for Sign In based on Application Claim