Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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 aren't 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.
Ensure you're 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:
Note
When you update VM sizes, you must specify the complete list of sizes you want in the scale set. This operation replaces the entire list, not just adds or removes individual sizes.
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 doesn't already use it, specify the skuProfile properties. You must set:
sku.nameto"Mix"sku.tiertonull- At least one value in
vmSizesunderskuProfile - An
allocationStrategy(if not specified, Azure defaults tolowestPrice)
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 \
--set skuProfile.allocationStrategy=capacityOptimized
Common update scenarios
Remove a specific VM size
To remove a specific VM size from the instance mix configuration, specify the complete list of VM sizes you want to keep, excluding the size you want to remove.
Example: Remove Standard_D2as_v4 from a scale set that has Standard_D2as_v4, Standard_D2s_v4, Standard_D2as_v5, and Standard_D2s_v5:
az vmss update \
--resource-group {resourceGroupName} \
--name {scaleSetName} \
--skuprofile-vmsizes Standard_D2s_v4 Standard_D2as_v5 Standard_D2s_v5
Add a specific VM size
To add a new VM size to the instance mix configuration, specify the complete list of VM sizes including both existing and new sizes.
Example: Add Standard_D4s_v5 to a scale set that currently has Standard_D2s_v4, Standard_D2as_v5, and Standard_D2s_v5:
az vmss update \
--resource-group {resourceGroupName} \
--name {scaleSetName} \
--skuprofile-vmsizes Standard_D2s_v4 Standard_D2as_v5 Standard_D2s_v5 Standard_D4s_v5
Next steps
Learn how to troubleshoot your instance mix-enabled scale set.