user3637767
user3637767

Reputation: 1

Using azure cli from virtual machine

I need to use the azure cli from within a linux virtual machine. There are two contraints:

  1. cannot use/store the credentials used for creating the VM on the VM.
  2. the login/authentication need to be automated (non-interactive)

On AWS, I can use instance profiles for such scenario, but I am unable to find any feasible approach for Azure. Any help is greatly appreciated.

Upvotes: 0

Views: 4090

Answers (3)

PersianIronwood
PersianIronwood

Reputation: 790

This is how it was resolved for me ,

  1. you need to be logged in to azure portal in your browser
  2. type az login --use-device-code in your ssh terminal
  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

Upvotes: 0

Maxirus
Maxirus

Reputation: 71

az login —msi has been deprecated (See here) as of v2.0.22.

The new method is to use the —identity option. ie. az login —identity. See az login docs for more information.

Upvotes: 2

Johan Stenberg - MSFT
Johan Stenberg - MSFT

Reputation: 124

If you are using Azure CLI 2.0, you can use az login with the --msi parameter to log in using the Virtual Machine's identity. See the az login documentation for more information.

Upvotes: 1

Related Questions