Search code examples
azureazure-vm-scale-set

Patching and Updating Virtual Machine ScaleSets


As I understand, Virtual Machine Scale Sets are a collection of Virtual Machines. Each one can be destroyed and reconstituted at the whim of the configuration. The VM's are recreated from a certain image. Is this understanding is correct ?

If this is correct, how do you patch a scaleset ?

Consider a scaleset created using a Windows 2016. 50 patches are made available via the update service since the base image was created. During a heavy load, 3 new VMs are created by the scaleset. The new VMs should load 50 patches before even going on-line. That could take hours. The patches might not work at all.

What is the best practice to handle this issue ?


Solution

  • I would like to suggest to create the VMSS from a custom image. You could first deploy a windows 2016 and install the 50 patches, then make this as a custom VM image. This custom VM image includes any required application installs or configurations. Any VM instances created in the scale set use the custom VM image and are ready to serve your application traffic. In this tutorial you learn how to:

    • Create and customize a VM
    • Deprovision and generalize the VM
    • Create a custom VM image
    • Deploy a scale set that uses the custom VM image

    You could make it with multiple methods.

    Tutorial: Create and use a custom image for virtual machine scale sets with Azure PowerShell

    Tutorial: Create and use a custom image for virtual machine scale sets with the Azure CLI

    Add a custom image to an Azure scale set template