Azure – Virtual machine Scale Sets now support automatic update for custom images

As you know with Azure Virtual Machine Scale Sets you can create and group identical virtual machines to deliver load balanced and highly available service; the number of virtual machine instances is automatically increased or decreased to match the demand.

You may also know that the operating system of each virtual machine part of a scale set can be automatically updated but this did not cover custom operating system image (see https://docs.microsoft.com/en-au/azure/virtual-machine-scale-sets/shared-image-galleries).

Well, good news, this automatic update for custom images is now available.

The process is the same than for ‘standard’ operating system images, with the same limitations:

  • Supported Operating Systems
    • Ubuntu Server 16.04 LTS and 18.04 LTS
    • CentOS 7.5
    • CoreOS
    • Windows Server 2012 R2 Datacenter, 2016 Datacenter (including the small disk or with containers SKU’s), 2019 Datacenter (including the small disk or with containers SKU’s)

Then you can enable the automatic update capability using either Azure Cli or Azure PowerShell (remember you can use Cloud Shell to execute the command) for each subscription you want to get it enabled:

  • Azure PowerShell

Register-AzProviderFeature -FeatureName AutomaticOSUpgradeWithGalleryImage -ProviderNamespace Microsoft.Compute

Register-AzResourceProvider -ProviderNamespace Microsoft.Compute

Then you can enable the automatic update on your scale set

Update-AzVmss -ResourceGroupName “<resource group where is located your scale set>” -VMScaleSetName “<your virtual machine scale set>” -AutomaticOSUpgrade $true

  • Azure Cli

az feature register –namespace Microsoft.Compute –name AutomaticOSUpgradeWithGalleryImage

az provider register –namespace Microsoft.Compute

Then you can enable the automatic update on your scale set

az vmss update –name “<your virtual machine scale set>” –resource-group “<resource group where is located your scale set>” –set UpgradePolicy.AutomaticOSUpgradePolicy.EnableAutomaticOSUpgrade=true

The first time, it can then take up to 2 hours for a scale set to get the first rollout; subsequent updates will be applied quicker.

Benoit Hamet
Benoit Hamet
Benoit is working on Microsoft collaborative technologies He has been awarded as MVP for more than 12 years Currently MVP on Office 365 after being awarded on SharePoint (2011-2012) and Windows client & server (2002-2007) Speaker at various Microsoft events (TechDays, TechNet seminars) and Quest Software He works on on-premises (Active Directory, RADIUS/NPS, Exchange, Skype for Business, SharePoint, SQL, Terminal Server, Windows client and Windows Server) or online (Azure, Intune, Office 365, Exchange Online, SharePoint Online, Skype for Business Online, Teams) technologies