0

I want to create a VM instance on azure through ansible/shell script from my machine.

ways i have found

  1. Installing az cli on my machine, az login and create instance.

Problem with az cli :In this way i can create instance but i need a session login for infinite time unless i logout. If i logout or system logs me out then i have to login manually with portal to cli which i don't want.If there is any automate process to login with keys or passwords.

can anyone suggesst me how can i acheive ?

Charles Xu
  • 29,862
  • 2
  • 22
  • 39
TechChain
  • 8,404
  • 29
  • 103
  • 228

1 Answers1

2

For your requirement, you can use the service principal to login both for the Azure CLI and ansible. In this way, it works as the username and password so that you need not log in with portal.

You can follow steps via the Azure CLI command to create the service principal and use it to log in. And the ansible steps here.

Charles Xu
  • 29,862
  • 2
  • 22
  • 39