简体   繁体   English

带有CLI的Azure VM

[英]Azure VM with cli

Is there a way to authenticate to Azure without any login on an Azure VM? 有没有一种方法可以在不登录Azure VM的情况下对Azure进行身份验证? Same feature like amazon instance profile so I can run azure commands without authentication 与Amazon实例配置文件类似的功能,因此我可以在无需身份验证的情况下运行azure命令

I don't think it is possible to communicate with Azure cloud without authentication like AWS using the instance profile. 我认为使用实例配置文件不进行像AWS这样的身份验证就无法与Azure云通信。 In Azure you have to use service principle with respective role(Reader, contributor or owner) assigned. 在Azure中,您必须使用已分配了各自角色(读者,贡献者或所有者)的服务原理。 Once service principle is created you can use it for authentication with Azure SDK or REST API. 创建服务原理后,可以将其用于Azure SDK或REST API的身份验证。 You can automate once you have service principle details. 拥有服务原理详细信息后,即可实现自动化。

You can use Azure CLI . 您可以使用Azure CLI

The authentication can be done using the Publish Settings file . 可以使用“ 发布设置”文件来完成身份验证。 This is useful if you wish to use Azure CLI commands in a script etc. 如果您希望在脚本等中使用Azure CLI命令,这将非常有用。

You can download the file by using 您可以使用下载文件

azure account download

Make sure you keep this file safe as it provides direct access to your azure account. 确保此文件安全,因为它可以直接访问您的Azure帐户。

Then authentication is a simple process of importing the file using 然后,身份验证是使用以下命令导入文件的简单过程

azure account import /path/to/.publishsettings_file

Now deployment commands can be run on the command line without logging in. 现在,无需登录即可在命令行上运行部署命令。

Scroll to the section public settings file in the link for more info on how to use the publish settings file. 滚动到链接中的公共设置文件部分,以获取有关如何使用发布设置文件的更多信息。

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

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