We have a custom vhd image in our blob storage and we want to create a new vm using that vhd image through cli 2.0 in azure. Can anyone point me right direction to do so or any suggestions would be appreciated.
Asked
Active
Viewed 1,824 times
1 Answers
4
We can use this script to create Azure VM, like this:
az vm create -n MyVm -g jasonvm2 --use-unmanaged-disk --os-type linux --public-ip-address "" --attach-os-disk https://jasonvm2disks653.blob.core.windows.net/vhds/jasonvm220170915094051.vhd
We can use --attach-os-disk
to specify the VHD's URL:
--attach-os-disk
Attach an existing OS disk to the VM. Can use the name or ID of a managed disk or the URI to an unmanaged disk VHD.
More information about az vm create
, please refer to this link.

Jason Ye
- 13,710
- 2
- 16
- 25
-
Hello Jason, but when we use this how can we pass the login credentials which are not applicable. my script az vm create -n CentosBaseVM -g MyRG --use-unmanaged-disk --os-type linux --public-ip-address "" --attach-os-disk https://link.blob.core.windows.net/imagevhds/CentOS7_3_base.vhd --admin-username uname --admin-password pwd --subnet subnet --public-ip-address "" --nsg "" --size Standard_DS1_v2 – kick07 Sep 15 '17 at 19:05
-
@Arun Please use `--ssh-key-value`, the SSH public key or public key file path. – Jason Ye Sep 18 '17 at 08:30