使用 .publishsettings 文件登录 Azure

Azure login using a .publishsettings file

我正在尝试使用 CLI 工具将保留 IP 分配给 VM。 在 运行 $: 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

我收到以下错误:

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.

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

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

更多信息可用here

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

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