VM availability sets - az vm availability-set

Group resources into availability sets for high-availability requirements.

To provide redundancy to your application, it is recommended that you group two or more virtual machines in an availability set. This configuration ensures that during either a planned or unplanned maintenance event, at least one virtual machine will be available and meet the 99.95% Azure SLA.

Commands

az vm availability-set convert Convert an Azure Availability Set to contain VMs with managed disks.
az vm availability-set create Create an Azure Availability Set.
az vm availability-set delete Delete an availability set.
az vm availability-set list Lists all availability sets in a resource group.
az vm availability-set list-sizes Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set.
az vm availability-set show Retrieves information about an availability set.
az vm availability-set update Update an Azure Availability Set.

az vm availability-set convert

Convert an Azure Availability Set to contain VMs with managed disks.

az vm availability-set convert --name
--resource-group

Examples

Use the availability set name to convert it from using unmanaged disks to managed disks.

vm availability-set convert -g MyResourceGroup -n MyAvSet

Use the availability set ID to convert it from using unmanaged disks to managed disks.

az vm availability-set convert --ids $(az vm availability-set     list -g MyResourceGroup --query "[].id" -o tsv)

Required Parameters

--name -n

Name of the availability set.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

az vm availability-set create

For more information, see https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-manage-availability.

az vm availability-set create --name
--resource-group
[--location]
[--no-wait]
[--platform-fault-domain-count]
[--platform-update-domain-count]
[--tags]
[--unmanaged]
[--validate]

Examples

Create an availability set.

az vm availability-set create -n MyAvSet -g MyResourceGroup --platform-fault-domain-count 2 --platform-update-domain-count 2

Required Parameters

--name -n

Name of the availability set.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

Optional Parameters

--location -l

Location. You can configure the default location using az configure --defaults location=.

--no-wait
--platform-fault-domain-count

Fault Domain count.

default value: 2
--platform-update-domain-count

Update Domain count. If unspecified, server picks the most optimal number like 5. For the latest defaults see https://docs.microsoft.com/en-us/rest/api/compute/availabilitysets/availabilitysets-create.

--tags

Space separated tags in 'key[=value]' format. Use "" to clear existing tags.

--unmanaged

Contained VMs should use unmanaged disks.

--validate

Generate and validate the ARM template without creating any resources.

az vm availability-set delete

Delete an availability set.

az vm availability-set delete --name
--resource-group

Examples

Delete an availability set.

az vm availability-set delete -n MyAvSet -g MyResourceGroup

Required Parameters

--name -n

Name of the availability set.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

az vm availability-set list

Lists all availability sets in a resource group.

az vm availability-set list --resource-group

Examples

List availability sets.

az vm availability-set list -g MyResourceGroup

Required Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

az vm availability-set list-sizes

Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set.

az vm availability-set list-sizes --name
--resource-group

Examples

List VM sizes for an availability set.

az vm availability-set list-sizes -n MyAvSet -g MyResourceGroup

Required Parameters

--name -n

Name of the availability set.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

az vm availability-set show

Retrieves information about an availability set.

az vm availability-set show --name
--resource-group

Examples

Get information about an availability set.

az vm availability-set show -n MyAvSet -g MyResourceGroup

Required Parameters

--name -n

Name of the availability set.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

az vm availability-set update

Update an Azure Availability Set.

az vm availability-set update --name
--resource-group
[--add]
[--remove]
[--set]

Examples

Update an availability set.

az vm availability-set update -n MyAvSet -g MyResourceGroup

Update an availability set tag.

az vm availability-set update -n MyAvSet -g MyResourceGroup --set tags.foo=value

Remove an availability set tag.

az vm availability-set update -n MyAvSet -g MyResourceGroup --remove tags.foo

Required Parameters

--name -n
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty .

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.