繁体   English   中英

从虚拟机使用 azure cli

[英]Using azure cli from virtual machine

我需要在 linux 虚拟机中使用 azure cli。 有两个约束:

  1. 无法使用/存储用于在 VM 上创建 VM 的凭据。
  2. 登录/身份验证需要自动化(非交互式)

在 AWS 上,我可以在这种情况下使用实例配置文件,但我无法为 Azure 找到任何可行的方法。 任何帮助是极大的赞赏。

如果使用的是Azure CLI 2.0 ,则可以使用带有--msi参数的az login来使用虚拟机的身份登录。 有关更多信息,请参见az登录文档

az login —msi开始,不再支持az login —msi (请参阅此处 )。

新方法是使用—identity选项。 即。 az login —identity 有关更多信息,请参见az登录文档。

这就是我的解决方法,

  1. 您需要在浏览器中登录 azure 门户
  2. 在 ssh 终端中键入az login --use-device-code
  3. It gives you a URL and a code, enter the URL in the same browser that you were logged in to azure portal and enter the code in the pop up window
  4. choose your email user for the azure portal in the next window and you will be logged in to azure cli in your ssh terminal

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM