Comment 4 for bug 1858495

Revision history for this message
Ryan Harper (raharper) wrote :

Sorry for missing the questions earlier.

Azure has two "machine types" gen1 which boots a non-uefi based virtual hardware platform and gen2 which is UEFI with newer virtual hardware, details here:

https://azure.microsoft.com/en-us/updates/generation-2-virtual-machines-in-azure-public-preview/?cdn=disable

I boot daily Ubuntu-Server Daily images: here's a gen1 launch:

az vm create --name=citest-singleboot-Standard-DS2-v2 \
   --image=Canonical:UbuntuServer:19.10-DAILY:19.10.201911270 \
   --admin-username=root --admin-username=ubuntu \
   -g cloud-init-sru --os-disk-size-gb 37 \
   --ssh-key-value /home/ubuntu/.ssh/id_rsa.pub \
   --boot-diagnostics-storage cibootdiagstor \
   --size Standard_DS2_v2 '--location=West US'

Gen2 launch looks like:

az vm create --name=cloudinit-azure-cloudtest \
   --image=Canonical:UbuntuServer:19_10-daily-gen2:19.10.202002050
   --admin-username=root --admin-username=ubuntu \
   -g cloud-init-sru --os-disk-size-gb 37 \
   --ssh-key-value /home/ubuntu/.ssh/id_rsa.pub \
   --boot-diagnostics-storage cibootdiagstor \
   --size Standard_DS2_v2 '--location=West US'

To make a template image after booting one of these images; you run the following:

# deallocate vm, generalize
az vm deallocate --resource-group $RESOURCE_GROUP --name $VM_NAME
az vm generalize --resource-group $RESOURCE_GROUP --name $VM_NAME
az image create --resource-group $RESOURCE_GROUP \
    $HV_GEN \
    --name $TEMPLATE_IMAGE --source $VM_NAME --location "$LOCATION"

And then you can launch an instance using your template image by
specifying the the $TEMPLATE_IMAGE value (you pick the name) to
the az create --image parameter above.

HV_GEN=--hyper-v-generation=V2 # only if you're creating an gen2 image template.