az vm availability-set

Group resources into availability sets.

To provide redundancy to an application, it is recommended to 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.

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 List availability sets.
az vm availability-set list-sizes List VM sizes for an availability set.
az vm availability-set show Get information for 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 [--ids]
[--name]
[--resource-group]
[--subscription]

Examples

Convert an availabiity set to use managed disks by name.

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

Convert an availability set to use managed disks by ID.

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

Optional Parameters

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--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=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az vm availability-set create

Create an Azure Availability Set.

az vm availability-set create --name
--resource-group
[--location]
[--no-wait]
[--platform-fault-domain-count]
[--platform-update-domain-count]
[--ppg]
[--subscription]
[--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=<name>.

Optional Parameters

--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--no-wait

Do not wait for the long-running operation to finish.

--platform-fault-domain-count

Fault Domain count.

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

Update Domain count. If unspecified, the server will pick the most optimal number like 5.

--ppg

The name or ID of the proximity placement group the availability set should be associated with.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--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 [--ids]
[--name]
[--resource-group]
[--subscription]

Examples

Delete an availability set.

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

Optional Parameters

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--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=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az vm availability-set list

List availability sets.

az vm availability-set list [--resource-group]
[--subscription]

Examples

List availability sets.

az vm availability-set list -g MyResourceGroup

Optional Parameters

--resource-group -g

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

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az vm availability-set list-sizes

List VM sizes for an availability set.

az vm availability-set list-sizes [--ids]
[--name]
[--resource-group]
[--subscription]

Examples

List VM sizes for an availability set.

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

Optional Parameters

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--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=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az vm availability-set show

Get information for an availability set.

az vm availability-set show [--ids]
[--name]
[--resource-group]
[--subscription]

Examples

Get information about an availability set.

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

Optional Parameters

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--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=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az vm availability-set update

Update an Azure Availability Set.

az vm availability-set update [--add]
[--force-string]
[--ids]
[--name]
[--remove]
[--resource-group]
[--set]
[--subscription]

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

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--name -n

Name of the availability set.

--remove

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

--resource-group -g

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

--set

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

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.