azure-xplat-cli icon indicating copy to clipboard operation
azure-xplat-cli copied to clipboard

How to create classic vm from existing OS image using cli

Open AMRivkin opened this issue 8 years ago • 4 comments

I've got blob from linux vm. I've uploaded it in my subscription and created OS disk. Now I'd like to create vm using this disk as OS disk.

azure vm disk create --os linux --blob-url http://xxxx.blob.core.windows.net/vhds/xxxx-os-4334.vhd xxxx-os-4334

How can I do it?

In new azure portal it's quite easy:

  1. Go to "OS disks (classic)"
  2. Select my disk, xxxx-os-4334
  3. Select "+ Create VM"
  4. Just enter new host name and select tier. No useres and passwords (they are already existing in this disk)

How can I repeat this steps using CLI?

The best thing I've found is to create image from my blob and then create new VM from this image. But in that case I've to enter username/password and VM is not starting.

Regards, Andrey

AMRivkin avatar Sep 21 '16 11:09 AMRivkin

the CLI is in two modes ARM (new) and ASM (classic). azure config mode asm. azure vm create -h should do the job for you. If not then azure vm -h can show you other available options in ASM.

/cc @huangpf

amarzavery avatar Sep 21 '16 14:09 amarzavery

I'm using ASM mode.

azure vm create always wants image (not os disk) and asks for user and password.

So if I executed azure vm disk create, then command azure vm create can't find my image. error: Image "xxxx-os-4334" not found

If I execute azure vm image create --blob-url http://xxxx.blob.core.windows.net/vhds/xxxx-os-4334.vhd --os linux xxxx and then do azure vm create it's asking for userName and Password.

Even if I use --blob-url azure vm create is asking for: error: --userName is required when is an OS image or a generalized image error: missing required argument `image'

So I'm a bit confused, how it's being done on portal?

Regards, Andrey

AMRivkin avatar Sep 21 '16 15:09 AMRivkin

@huangpf - Can you take a look into this?

amarzavery avatar Sep 21 '16 16:09 amarzavery

Any news on this thread? There is no way to create a VM from a specialized disk via CLI

inglele avatar Jan 11 '17 20:01 inglele