Azure Classroom Series – 19/May/2021

Creating Custom VM Image For Linux VMs

  • Login into the Linux VM
  • Deprovision the VM
sudo waagent -deprovision+user
  • Deallocate the VM
az vm deallocate --resource-group <your resg name> --name <name of vm>
  • Mark this VM as generalized
az vm generalize --resource-group <your resg name> --name <name of vm>
  • Now we can create the image
az image create --resource-group <your resg name> --name <name of the image> --source myVM

Creating Custom VM Image For Windows VMs

  • Login into Windows Server VM
  • Generalize the Windows VM using Sysprep Preview
  • Deallocate the VM
az vm deallocate --resource-group <your resg name> --name <name of vm>
  • Mark this VM as generalized
az vm generalize --resource-group <your resg name> --name <name of vm>
  • Now we can create the image
az image create --resource-group <your resg name> --name <name of the image> --source myVM
  • Image Creation can be automate using tools like Packer

Shared Image Gallery

  • Lets Create Shared Image Gallery
  • Create an Image definition
  • Create an Image Version from VM/disk/Managed Image Preview Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin