2
votes

I'm trying to assign a reserved IP to a VM using the CLI tools. After running $: 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

I received following 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.

Is there a way to use .publishsettings file only to achieve this task?

1

1 Answers

2
votes

No, at least not when you are in ARM mode. Using the .publishsettings file to authenticate from the CLI tools is only supported in the ASM mode.

More information available here.

You can still achieve a non-interactive login using CLI but it will require that you authenticate to Azure AD using a Work/School account (aka Organizational account). So, create an admin user (or service principal) in your Azure AD if you don't already have one. Then, add the azure login command to the top of your CLI script. For example...

azure login --username [email protected] --password passw0rD!
azure network nic set LAMP-Test FirstReservedIP