Create virtual machines in a Flexible scale set using Azure CLI
Applies to: ✔️ Flexible scale sets
This article steps through using the Azure CLI to create a virtual machine scale set in Flexible orchestration mode. For more information about Flexible scale sets, see Flexible orchestration mode for virtual machine scale sets.
Make sure that you have installed the latest Azure CLI and are logged in to an Azure account with az login.
Caution
The orchestration mode is defined when you create the scale set and cannot be changed or updated later.
Get started with Flexible scale sets
Create a Flexible virtual machine scale set with Azure CLI.
Add multiple VMs to a scale set
In the following example, we specify a virtual machine profile (VM type, networking configuration, etc.) and number of instances to create (instance count = 2).
az vmss create
--name $vmssName
--resource-group $rg
--image UbuntuLTS
--instance-count 2
--orchestration-mode flexible
Add a single VM to a scale set
The following example shows the creation of a Flexible scale set without a VM profile, where the fault domain count is set to 1. A virtual machine is created and then added to the Flexible scale set.
vmoname="my-vmss-vmo"
vmname="myVM"
rg="my-resource-group"
az group create -n "$rg" -l $location
az vmss create -n "$vmoname" -g "$rg" -l $location --orchestration-mode vm --platform-fault-domain-count 1
az vm create -n "$vmname" -g "$rg" -l $location --vmss $vmoname --image UbuntuLTS