Hello Varshney, Aayushi, the 400 Bad Request error typically indicates that some parameter passed to the az sig image-version create
command is either invalid, malformed, or missing. In your case, based on the verbose part of the URL, --sku ""v1.0""
is invalid — double quotes inside double quotes.
It should be --sku v1 or any non-empty string without special quotes. Also managed image $IMAGE_NAME
is not found or incorrectly referenced. You need to reference either a managed image resource ID or an existing VM name (if using --source
)
or you might have incorrect --hyper-v-generation
vs source image compatibility i.e. if you have set --hyper-v-generation V2
but your source image is V1 or doesn’t support secure boot.
Please reference from the below steps and let me know
az vm create \
--resource-group arkorg \
--name mySourceVM \
--image Canonical:UbuntuServer:18_04-lts-gen1:latest \
--size Standard_D2s_v3 \
--admin-username azureuser \
--generate-ssh-keys \
--security-type Standard \
--enable-secure-boot false \
--enable-vtpm false
Note- Only Gen1 images work here. Gen2 images often cause SecureBootClientError
if they are unsigned. You can list Gen1 images using-
az vm image list \
--publisher Canonical \
--offer UbuntuServer \
--sku 18_04-lts \
--all \
--location westeurope \
--output table
Generalize the VM
az vm deallocate --resource-group arkorg --name whatever_is_ur_vm_name
az vm generalize --resource-group arkorg --name whatever_is_ur_vm_name
Create a shared image gallery & definition
az sig create \
--resource-group arkorg \
--gallery-name myGallery
az sig image-definition create \
--resource-group arkorg \
--gallery-name myGallery \
--gallery-image-definition myImageDef \
--publisher myPublisher \
--offer UbuntuServer \
--sku v1 \
--os-type Linux \
--os-state Generalized \
--hyper-v-generation V1
Please note- default is Gen2 with TrustedLaunch. Use --hyper-v-generation V1
explicitly and omit security flags if using az sig image-definition
.
Create an image version from the generalized VM
az sig image-version create \
--resource-group arkorg \
--gallery-name myGallery \
--gallery-image-definition myImageDef \
--gallery-image-version 1.0.0 \
--managed-image /subscriptions/<SUB_ID>/resourceGroups/arkorg/providers/Microsoft.Compute/images/myManagedImage
Alternatively, if you're using a VM directly the run this-
az sig image-version create \
--resource-group arkorg \
--gallery-name myGallery \
--gallery-image-definition myImageDef \
--gallery-image-version 1.0.0 \
--source mySourceVM
Reference MS documents-