Azure登录使用.publishsettings文件

时间:2016-05-19 12:04:41

标签: bash azure authentication azure-cli

我正在尝试使用CLI工具为VM分配保留的IP。 运行$:azure network nic set [

pawel@LAMP-Test:~$ azure network nic set LAMP-Test FirstReservedIP
info:    Executing command network nic set
error:   The current cmdlet requires you to log in using Azure Active Directory account, not from a .publishsettings file. Please run 'azure login' or use 'azure account set' to select a correct subscription.
info:    Error information has been recorded to /home/pawel/.azure/azure.err
error:   network nic set command failed      

info:    Executing command network nic set
error:   The current cmdlet requires you to log in using Azure Active Directory account, not from a .publishsettings file. Please run 'azure login' or use 'azure account set' to select a correct subscription.
info:    Error information has been recorded to /home/pawel/.azure/azure.err
error:   network nic set command failed  
 azure network nic set LAMP-Test FirstReservedIP
    

] 1 FirstReservedIp

我收到以下错误:

  

当前cmdlet要求您使用Azure Active Directory登录   帐户,而不是.publishsettings文件。请运行'azure login'或   使用'azure account set'选择正确的订阅。

有没有办法只使用.publishsettings文件来完成这项任务?

1 个答案:

答案 0 :(得分:1)

不,至少在你处于ARM模式时不行。仅在ASM模式下支持使用.publishsettings文件从CLI工具进行身份验证。

提供更多信息here

您仍然可以使用CLI实现非交互式登录,但需要使用Work / School帐户(也称为组织帐户)对Azure AD进行身份验证。因此,如果您还没有Azure用户,请在Azure AD中创建管理员用户(或服务主体)。然后,将azure login命令添加到CLI脚本的顶部。例如......

azure login --username johndoe@contoso.onmicrosoft.com --password passw0rD!
azure network nic set LAMP-Test FirstReservedIP