/resourceGroups/RG1/providers/Microsoft.Compute/galleries/windo" /> /resourceGroups/RG1/providers/Microsoft.Compute/galleries/windo" /> /resourceGroups/RG1/providers/Microsoft.Compute/galleries/windo"/>

How to have azure cli not ask for password while creating a new vm from specialized Windows image?

519 Views Asked by At
az vm create \
--resource-group RG1\
--name sts-test-1 \
--image "/subscriptions/<guid>/resourceGroups/RG1/providers/Microsoft.Compute/galleries/windows_sts/images/windows_sts_image/versions/0.0.6" \
--specialized true

Admin Password:

Confirm Admin Password:

I was expecting it to not ask for password as the image is already specified as specialized . I tried passing in the password via a file using command < pass.txt which results in another message.

ERROR: Please specify password in non-interactive mode.

Need a way to either bypass the password or not pass it at all.

1

There are 1 best solutions below

1
Imran On

I tried to reproduce the same in my environment and got the same results as below:

enter image description here

You can pass the Admin Password in the command while creating the VM like below:

az vm create
--resource-group RG!
--name MyVm
--image Win2022AzureEditionCore
--location westeurope
--admin-username Name
--admin-password Password

I am able to create Vm successfully by passing the Admin Password in the command like below:

enter image description here

enter image description here