Edit

Share via


Update instance mix settings on an existing scale set

This article explains how to update the instance mix settings on a scale set, including changing VM sizes and allocation strategies.

Update the instance mix settings on an existing scale set

The instance mix settings can be updated on your scale set via CLI, PowerShell, and REST API. You can change either the virtual machine (VM) sizes or the allocation strategy, or both, in a single call.

Note

When you change the allocation strategy, the new strategy takes effect only after the scale set scales in or out. Existing VMs are not affected until a scaling action occurs.

When changing from Prioritized (preview) to another allocation strategy, you must first nullify the priority ranks associated with the VM sizes. This will be covered in more detail in the supporting code snippets.

Ensure you are using Azure CLI version 2.66.0 or later.

Change the allocation strategy

To update the allocation strategy, for example, to CapacityOptimized:

az vmss update \
  --resource-group {resourceGroupName} \
  --name {scaleSetName} \
  --set skuProfile.allocationStrategy=CapacityOptimized

Change the VM sizes

To update the VM sizes in the skuProfile, for example, to Standard_D2as_v4, Standard_D2as_v5, and Standard_D2s_v5:

az vmss update \
  --resource-group {resourceGroupName} \
  --name {scaleSetName} \
  --skuprofile-vmsizes Standard_D2as_v4 Standard_D2as_v5 Standard_D2s_v5

Enable instance mix on an existing scale set

To enable instance mix on a scale set that does not already use it, specify the skuProfile properties. You must set:

  • sku.name to "Mix"
  • sku.tier to null
  • At least one value in vmSizes under skuProfile
  • An allocationStrategy (if not specified, Azure defaults to lowestPrice)

The following examples show how to enable instance mix on an existing scale set.

This example updates an existing scale set in Flexible Orchestration Mode to use instance mix with VM sizes Standard_D2as_v4, Standard_D2s_v5, and Standard_D2as_v5, and the capacityOptimized allocation strategy:

az vmss update \
  --name {scaleSetName} \
  --resource-group {resourceGroupName} \
  --set sku.name=Mix sku.tier=null \
  --skuprofile-vmsizes Standard_D2as_v4 Standard_D2s_v5 Standard_D2as_v5 \
  --sku-allocat-strat capacityOptimized

Next steps

Learn how to troubleshoot your instance mix-enabled scale set.