az image create -- Limited command options as compared to Azure Portal
See original GitHub issue
az feedback
auto-generates most of the information requested below, as of CLI version 2.0.62
Describe the bug
Perhaps a maturity issue as opposed to bug. The documentation for az image create does not list a clear way to specify storage-sku for each data disk attached to an image.
Also encryption options visible in Image create UI, is not listed in configuration options in Azure CLI.
Sample command: – this is a long multi-line command in windows cmd. It works, but does not allow specifying encryption at rest, or per data disk storage type, as seen in the GUI.
az image create --name image1 -g resource_group01 --os-type Linux --location eastus --hyper-v-generation V1 ^ –zone-resilient true --storage-sku Premium_LRS ^ –source https://storage1.blob.core.windows.net/container1/root-disk.vhd ^ –data-disk-sources https://storage1.blob.core.windows.net/container1/second-disk.vhd https://storagestratozen.blob.core.windows.net/container1/third-disk.vhd ^ –os-disk-caching ReadWrite ^ –data-disk-caching ReadWrite ^
//Relevant documentation https://docs.microsoft.com/en-us/cli/azure/image?view=azure-cli-latest#az-image-create
In Summary:
- How do I specify encryption for the image, as seen in the UI?
- How do I specify storage type (premium etc) per data disk if multiple?
- How do I specify disk read/write caching per data disk added? – I mean usually I’ll do read/write for everything, but why does the option not exist?
Is there a simple way to do this via azure cli, or do I have to use some way to input json (no example documentation). Is the only option an ARM template?
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (10 by maintainers)
Top GitHub Comments
@zhoxing-ms Yes, all these features are supported in the REST API. Customers are only able to specify all three settings if they use disks, snapshots or blobs to create the image. For customers that use VMs to create their image, the settings have to be applied to the disks on the VM before the image capture process.
Here is a sample that has uses encryption, specifies storage type, and the caching.
@olayemio OK, I see. Thank you for the example. We will arrange development for this requirement~