简体   繁体   中英

Specify managed disk names in Azure when creating vm from image

We created an image from a VM that had two disks, an OS and Data disk for MySQL.

If I create a vm from the image the disk resources get funky suffixes. Is it possible to specify the name of the resources for both disks?

Looks like if done through CLI I can use the os-disk-name parameter, but I don't seen any way to specify the name of the additional disk.

Looks like if done through CLI I can use the os-disk-name parameter, but I don't seen any way to specify the name of the additional disk.

You are right, for now, Azure CLI 2.0 does not support specify the name of data disk with command az vm create .

As a workaround, we can use this command to create data disk and specify the name of it.

az disk create -n MyDisk -g MyResourceGroup --size-gb 10 --location eastus2

Then we can use this parameter --attach-data-disks to attach this data disk to new VM, script like this:

az vm create -n jasonvm -g jasonvm --image centos  --os-disk-name jasonosdisk --admin-username jason --admin-password password --public-ip-address "" --attch-data-disks mydisk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM