az vmss

Manage groupings of virtual machines in an Azure Virtual Machine Scale Set (VMSS).

Commands

az vmss create Create an Azure Virtual Machine Scale Set.
az vmss deallocate Deallocate VMs within a VMSS.
az vmss delete Deletes a VM scale set.
az vmss delete-instances Delete VMs within a VMSS.
az vmss diagnostics Configure the Azure Virtual Machine Scale Set diagnostics extension.
az vmss diagnostics get-default-config Show the default config file which defines data to be collected.
az vmss diagnostics set Enable diagnostics on a VMSS.
az vmss disk Manage data disks of a VMSS.
az vmss disk attach Attach managed data disks to a scale set or its instances.
az vmss disk detach Detach managed data disks from a scale set or its instances.
az vmss encryption Manage encryption of VMSS.
az vmss encryption disable Disable the encryption on a VMSS with managed disks.
az vmss encryption enable Encrypt a VMSS with managed disks.
az vmss encryption show Show encryption status.
az vmss extension Manage extensions on a VM scale set.
az vmss extension delete Delete an extension from a VMSS.
az vmss extension image Find the available VM extensions for a subscription and region.
az vmss extension image list List the information on available extensions.
az vmss extension image list-names Gets a list of virtual machine extension image types.
az vmss extension image list-versions Gets a list of virtual machine extension image versions.
az vmss extension image show Gets a virtual machine extension image.
az vmss extension list List extensions associated with a VMSS.
az vmss extension set Add an extension to a VMSS or update an existing extension.
az vmss extension show Show details on a VMSS extension.
az vmss get-instance-view View an instance of a VMSS.
az vmss get-os-upgrade-history Gets list of OS upgrades on a VM scale set instance.
az vmss identity Manage service identities of a VM scaleset.
az vmss identity assign Enable managed service identity on a VMSS.
az vmss identity remove Remove user assigned identities from a VM scaleset.
az vmss identity show Display VM scaleset's managed identity info.
az vmss list List VMSS.
az vmss list-instance-connection-info Get the IP address and port number used to connect to individual VM instances within a set.
az vmss list-instance-public-ips List public IP addresses of VM instances within a set.
az vmss list-instances Gets a list of all virtual machines in a VM scale sets.
az vmss list-skus Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for each SKU.
az vmss nic Manage network interfaces of a VMSS.
az vmss nic list Gets all network interfaces in a virtual machine scale set.
az vmss nic list-vm-nics Gets information about all network interfaces in a virtual machine in a virtual machine scale set.
az vmss nic show Get the specified network interface in a virtual machine scale set.
az vmss perform-maintenance Perform maintenance on one or more virtual machines in a VM scale set.
az vmss reimage Reimage VMs within a VMSS.
az vmss restart Restart VMs within a VMSS.
az vmss rolling-upgrade Manage rolling upgrades.
az vmss rolling-upgrade cancel Cancels the current virtual machine scale set rolling upgrade.
az vmss rolling-upgrade get-latest Gets the status of the latest virtual machine scale set rolling upgrade.
az vmss rolling-upgrade start Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image OS version.
az vmss run-command Manage run commands on a Virtual Machine Scale Set.
az vmss run-command invoke Execute a specific run command on a Virtual Machine Scale Set instance.
az vmss run-command list Lists all available run commands for a subscription in a location.
az vmss run-command show Gets specific run command for a subscription in a location.
az vmss scale Change the number of VMs within a VMSS.
az vmss show Get details on VMs within a VMSS.
az vmss start Start VMs within a VMSS.
az vmss stop Power off (stop) VMs within a VMSS.
az vmss update Update a VMSS.
az vmss update-instances Upgrade VMs within a VMSS.
az vmss wait Place the CLI in a waiting state until a condition of a scale set is met.

az vmss create

Create an Azure Virtual Machine Scale Set.

az vmss create --image
--name
--resource-group
[--accelerated-networking {false, true}]
[--admin-password]
[--admin-username]
[--app-gateway]
[--app-gateway-capacity]
[--app-gateway-sku]
[--app-gateway-subnet-address-prefix]
[--asgs]
[--assign-identity]
[--authentication-type {all, password, ssh}]
[--backend-pool-name]
[--backend-port]
[--custom-data]
[--data-disk-caching]
[--data-disk-sizes-gb]
[--disable-overprovision]
[--dns-servers]
[--ephemeral-os-disk {false, true}]
[--eviction-policy {Deallocate, Delete}]
[--generate-ssh-keys]
[--health-probe]
[--instance-count]
[--lb]
[--lb-nat-pool-name]
[--lb-sku {Basic, Standard}]
[--license-type {None, Windows_Client, Windows_Server}]
[--location]
[--no-wait]
[--nsg]
[--os-disk-caching {None, ReadOnly, ReadWrite}]
[--os-disk-name]
[--os-type {linux, windows}]
[--plan-name]
[--plan-product]
[--plan-promotion-code]
[--plan-publisher]
[--platform-fault-domain-count]
[--ppg]
[--priority {Low, Regular}]
[--public-ip-address]
[--public-ip-address-allocation {dynamic, static}]
[--public-ip-address-dns-name]
[--public-ip-per-vm]
[--role]
[--scope]
[--secrets]
[--single-placement-group {false, true}]
[--ssh-dest-key-path]
[--ssh-key-values]
[--storage-container-name]
[--storage-sku]
[--subnet]
[--subnet-address-prefix]
[--subscription]
[--tags]
[--ultra-ssd-enabled {false, true}]
[--upgrade-policy-mode {Automatic, Manual, Rolling}]
[--use-unmanaged-disk]
[--validate]
[--vm-domain-name]
[--vm-sku]
[--vnet-address-prefix]
[--vnet-name]
[--zones {1, 2, 3}]

Examples

Create a Windows VM scale set with 5 instances, a load balancer, a public IP address, and a 2GB data disk.

az vmss create -n MyVmss -g MyResourceGroup --instance-count 5 --image Win2016Datacenter --data-disk-sizes-gb 2

Create a Linux VM scale set with an auto-generated ssh key pair, a public IP address, a DNS entry, an existing load balancer, and an existing virtual network.

az vmss create -n MyVmss -g MyResourceGroup --public-ip-address-dns-name my-globally-dns-name \
                            --load-balancer MyLoadBalancer --vnet-name MyVnet --subnet MySubnet --image UbuntuLTS \
                            --generate-ssh-keys

Create a Linux VM scale set from a custom image using the default existing public SSH key.

az vmss create -n MyVmss -g MyResourceGroup --image MyImage

Create a Linux VM scale set with a load balancer and custom DNS servers. Each VM has a public-ip address and a custom domain name.

az vmss create -n MyVmss -g MyResourceGroup --image centos \
                            --public-ip-per-vm --vm-domain-name myvmss --dns-servers 10.0.0.6 10.0.0.5

Create a Linux VM scale set using a cloud-init script for configuration. See: https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init

az vmss create -g MyResourceGroup -n MyVmss --image debian --custom-data MyCloudInitScript.yml

Create a Debian VM scaleset using Key Vault secrets.

az keyvault certificate create --vault-name vaultname -n cert1 \
                          -p "$(az keyvault certificate get-default-policy)"
                        
                        secrets=$(az keyvault secret list-versions --vault-name vaultname \
                          -n cert1 --query "[?attributes.enabled].id" -o tsv)
                        
                        vm_secrets=$(az vm secret format -s "$secrets")
                        
                        az vmss create -g group-name -n vm-name --admin-username deploy  \
                          --image debian --secrets "$vm_secrets"

Create a VM scaleset with system assigned identity. The VM will have a 'Contributor' Role with access to a storage account.

az vmss create -n MyVmss -g MyResourceGroup --image centos --assign-identity --scope /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/MyResourceGroup/myRG/providers/Microsoft.Storage/storageAccounts/storage1

Create a debian VM scaleset with a user assigned identity.

az vmss create -n MyVmss -g rg1 --image debian --assign-identity  /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/resourcegroups/myRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myID

Create a debian VM scaleset with both system and user assigned identity.

az vmss create -n MyVmss -g rg1 --image debian --assign-identity  [system] /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/resourcegroups/myRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myID

Create a single zone VM scaleset in the current resource group's region

az vmss create -n MyVmss -g MyResourceGroup --image Centos --zones 1

Required Parameters

--image

The name of the operating system image as a URN alias, URN, custom image name or ID, or VHD blob URI. Valid URN format: "Publisher:Offer:Sku:Version".

value from: az vm image list, az vm image show
--name -n

Name of the virtual machine scale set.

--resource-group -g

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

Optional Parameters

--accelerated-networking

Enable accelerated networking. Unless specified, CLI will enable it based on machine image and size.

accepted values: false, true
--admin-password

Password for the VM if authentication type is 'Password'.

--admin-username

Username for the VM.

default value: your_system_user_login_name
--app-gateway

Name to use when creating a new application gateway (default) or referencing an existing one. Can also reference an existing application gateway by ID or specify "" for none.

--app-gateway-capacity

The number of instances to use when creating a new application gateway.

default value: 10
--app-gateway-sku

SKU when creating a new application gateway.

default value: Standard_Large
--app-gateway-subnet-address-prefix

The subnet IP address prefix to use when creating a new application gateway in CIDR format.

--asgs

Space-separated list of existing application security groups to associate with the VM.

--assign-identity

Accept system or user assigned identities separated by spaces. Use '[system]' to refer system assigned identity, or a resource id to refer user assigned identity. Check out help for more examples.

--authentication-type

Type of authentication to use with the VM. Defaults to password for Windows and SSH public key for Linux. "all" enables both ssh and password authentication.

accepted values: all, password, ssh
--backend-pool-name

Name to use for the backend pool when creating a new load balancer or application gateway.

--backend-port

When creating a new load balancer, backend port to open with NAT rules (Defaults to 22 on Linux and 3389 on Windows). When creating an application gateway, the backend port to use for the backend HTTP settings.

--custom-data

Custom init script file or text (cloud-init, cloud-config, etc..).

--data-disk-caching

Storage caching type for data disk(s), including 'None', 'ReadOnly', 'ReadWrite', etc. Use a singular value to apply on all disks, or use '= =' to configure individual disk.

--data-disk-sizes-gb

Space-separated empty managed data disk sizes in GB to create.

--disable-overprovision
--dns-servers

Space-separated IP addresses of DNS servers, e.g. 10.0.0.5 10.0.0.6.

--ephemeral-os-disk

Allows you to create an OS disk directly on the host node, providing local disk performance and faster VM/VMSS reimage time.

accepted values: false, true
--eviction-policy

The eviction policy for virtual machines in a low priority scale set.

accepted values: Deallocate, Delete
--generate-ssh-keys

Generate SSH public and private key files if missing. The keys will be stored in the ~/.ssh directory.

--health-probe

Probe name from the existing load balancer, mainly used for rolling upgrade.

--instance-count

Number of VMs in the scale set.

default value: 2
--lb --load-balancer

Name to use when creating a new load balancer (default) or referencing an existing one. Can also reference an existing load balancer by ID or specify "" for none.

--lb-nat-pool-name --nat-pool-name

Name to use for the NAT pool when creating a new load balancer.

--lb-sku

Sku of the Load Balancer to create. Default to 'Standard' when single placement group is turned off; otherwise, default to 'Basic'.

accepted values: Basic, Standard
--license-type

Specifies that the Windows image or disk was licensed on-premises. To enable Azure Hybrid Benefit for Windows Server, use 'Windows_Server'. To enable Multitenant Hosting Rights for Windows 10, use 'Windows_Client'. For more information see the Azure Windows VM online docs.

accepted values: None, Windows_Client, Windows_Server
--location -l

Location in which to create VM and related resources. If default location is not configured, will default to the resource group's location.

--no-wait

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

--nsg

Name or ID of an existing Network Security Group.

--os-disk-caching

Storage caching type for the VM OS disk. Default: ReadWrite.

accepted values: None, ReadOnly, ReadWrite
--os-disk-name

The name of the new VM OS disk.

--os-type

Type of OS installed on a custom VHD. Do not use when specifying an URN or URN alias.

accepted values: linux, windows
--plan-name

Plan name.

--plan-product

Plan product.

--plan-promotion-code

Plan promotion code.

--plan-publisher

Plan publisher.

--platform-fault-domain-count

Fault Domain count for each placement group in the availability zone.

--ppg

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

--priority

Priority. Use 'Low' to run short-lived workloads in a cost-effective way.

accepted values: Low, Regular
--public-ip-address

Name of the public IP address when creating one (default) or referencing an existing one. Can also reference an existing public IP by ID or specify "" for None.

--public-ip-address-allocation
accepted values: dynamic, static
--public-ip-address-dns-name

Globally unique DNS name for a newly created public IP.

--public-ip-per-vm

Each VM instance will have a public ip. For security, you can use '--nsg' to apply appropriate rules.

--role

Role name or id the system assigned identity will have.

default value: Contributor
--scope

Scope that the system assigned identity can access.

--secrets

One or many Key Vault secrets as JSON strings or files via @{path} containing [{ "sourceVault": { "id": "value" }, "vaultCertificates": [{ "certificateUrl": "value", "certificateStore": "cert store name (only on windows)"}] }].

--single-placement-group

Enable replicate using fault domains within the same cluster. Default to 'false' for any zonals, or with 100+ instances See https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-placement-groups for details.

accepted values: false, true
--ssh-dest-key-path

Destination file path on the VM for the SSH key. If the file already exists, the specified key(s) are appended to the file.

--ssh-key-values

Space-separated list of SSH public keys or public key file paths.

--storage-container-name

Only applicable when used with --use-unmanaged-disk. Name of the storage container for the VM OS disk. Default: vhds.

default value: vhds
--storage-sku

The SKU of the storage account with which to persist VM. Use a singular sku that would be applied across all disks, or specify individual disks. Usage: [--storage-sku SKU | --storage-sku ID=SKU ID=SKU ID=SKU...], where each ID is "os" or a 0-indexed lun. Allowed values: Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS.

--subnet

The name of the subnet when creating a new VNet or referencing an existing one. Can also reference an existing subnet by ID. If omitted, an appropriate VNet and subnet will be selected automatically, or a new one will be created.

--subnet-address-prefix

The subnet IP address prefix to use when creating a new VNet in CIDR format.

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

--ultra-ssd-enabled

Enables or disables the capability to have 1 or more managed data disks with UltraSSD_LRS storage account.

accepted values: false, true
--upgrade-policy-mode
accepted values: Automatic, Manual, Rolling
default value: manual
--use-unmanaged-disk

Do not use managed disk to persist VM.

--validate

Generate and validate the ARM template without creating any resources.

--vm-domain-name

Domain name of VM instances, once configured, the FQDN is 'vm..<..rest..>'.

--vm-sku

Size of VMs in the scale set. Default to "Standard_DS1_v2". See https://azure.microsoft.com/en-us/pricing/details/virtual-machines/ for size info.

--vnet-address-prefix

The IP address prefix to use when creating a new VNet in CIDR format.

default value: 10.0.0.0/16
--vnet-name

Name of the virtual network when creating a new one or referencing an existing one.

--zones -z

Space-separated list of availability zones into which to provision the resource.

accepted values: 1, 2, 3

az vmss deallocate

Deallocate VMs within a VMSS.

az vmss deallocate --name
--resource-group
[--instance-ids]
[--no-wait]
[--subscription]

Examples

Deallocate VMs within a VMSS. (autogenerated)

az vmss deallocate --name MyScaleSet --resource-group MyResourceGroup

Required Parameters

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--resource-group -g

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

Optional Parameters

--instance-ids

Space-separated list of IDs (ex: 1 2 3 ...) or * for all instances. If not provided, the action will be applied on the scaleset itself.

--no-wait

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

--subscription

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

az vmss delete

Deletes a VM scale set.

az vmss delete [--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]

Optional Parameters

--ids

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

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--no-wait

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

--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 vmss delete-instances

Delete VMs within a VMSS.

az vmss delete-instances --instance-ids
--name
--resource-group
[--no-wait]
[--subscription]

Examples

Delete VMs within a VMSS. (autogenerated)

az vmss delete-instances --instance-ids 0 --name MyScaleSet --resource-group MyResourceGroup

Required Parameters

--instance-ids

Space-separated list of IDs (ex: 1 2 3 ...) or * for all instances.

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--resource-group -g

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

Optional Parameters

--no-wait

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

--subscription

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

az vmss get-instance-view

View an instance of a VMSS.

az vmss get-instance-view [--ids]
[--instance-id]
[--name]
[--resource-group]
[--subscription]

Examples

View an instance of a VMSS. (autogenerated)

az vmss get-instance-view --name MyScaleSet --resource-group MyResourceGroup

Optional Parameters

--ids

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

--instance-id

A VM instance ID or "*" to list instance view for all VMs in a scale set.

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--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 vmss get-os-upgrade-history

Gets list of OS upgrades on a VM scale set instance.

az vmss get-os-upgrade-history [--ids]
[--name]
[--resource-group]
[--subscription]

Optional Parameters

--ids

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

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--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 vmss list

List VMSS.

az vmss list [--resource-group]
[--subscription]

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 vmss list-instance-connection-info

Get the IP address and port number used to connect to individual VM instances within a set.

az vmss list-instance-connection-info [--ids]
[--name]
[--resource-group]
[--subscription]

Examples

Get the IP address and port number used to connect to individual VM instances within a set. (autogenerated)

az vmss list-instance-connection-info --name MyScaleSet --resource-group MyResourceGroup

Optional Parameters

--ids

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

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--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 vmss list-instance-public-ips

List public IP addresses of VM instances within a set.

az vmss list-instance-public-ips [--ids]
[--name]
[--resource-group]
[--subscription]

Examples

List public IP addresses of VM instances within a set. (autogenerated)

az vmss list-instance-public-ips --name MyScaleSet --resource-group MyResourceGroup

Optional Parameters

--ids

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

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--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 vmss list-instances

Gets a list of all virtual machines in a VM scale sets.

az vmss list-instances [--expand]
[--filter]
[--ids]
[--name]
[--resource-group]
[--select]
[--subscription]

Optional Parameters

--expand

The expand expression to apply to the operation.

--filter

The filter to apply to the operation.

--ids

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

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--resource-group -g

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

--select

The list parameters.

--subscription

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

az vmss list-skus

Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for each SKU.

az vmss list-skus [--ids]
[--name]
[--resource-group]
[--subscription]

Optional Parameters

--ids

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

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--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 vmss perform-maintenance

Perform maintenance on one or more virtual machines in a VM scale set.

az vmss perform-maintenance [--ids]
[--instance-ids]
[--name]
[--resource-group]
[--subscription]

Optional Parameters

--ids

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

--instance-ids

Space-separated list of IDs (ex: 1 2 3 ...) or * for all instances. If not provided, the action will be applied on the scaleset itself.

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--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 vmss reimage

Reimage VMs within a VMSS.

az vmss reimage [--ids]
[--instance-id]
[--name]
[--no-wait]
[--resource-group]
[--subscription]

Examples

Reimage VMs within a VMSS

az vmss reimage --instance-id instanceId --name MyScaleSet --no-wait --resource-group MyResourceGroup

Optional Parameters

--ids

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

--instance-id

VM instance ID. If missing, reimage all instances.

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--no-wait

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

--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 vmss restart

Restart VMs within a VMSS.

az vmss restart --name
--resource-group
[--instance-ids]
[--no-wait]
[--subscription]

Examples

Restart VMs within a VMSS. (autogenerated)

az vmss restart --name MyScaleSet --resource-group MyResourceGroup

Required Parameters

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--resource-group -g

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

Optional Parameters

--instance-ids

Space-separated list of IDs (ex: 1 2 3 ...) or * for all instances. If not provided, the action will be applied on the scaleset itself.

--no-wait

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

--subscription

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

az vmss scale

Change the number of VMs within a VMSS.

az vmss scale --new-capacity
[--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]

Examples

Change the number of VMs within a VMSS. (autogenerated)

az vmss scale --name MyScaleSet --new-capacity 6 --resource-group MyResourceGroup

Required Parameters

--new-capacity

Number of VMs in the VMSS.

Optional Parameters

--ids

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

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--no-wait

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

--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 vmss show

Get details on VMs within a VMSS.

az vmss show --name
--resource-group
[--instance-id]
[--subscription]

Examples

Get details on VMs within a VMSS. (autogenerated)

az vmss show --name MyScaleSet --resource-group MyResourceGroup

Required Parameters

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--resource-group -g

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

Optional Parameters

--instance-id

VM instance ID. If missing, show the VMSS.

--subscription

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

az vmss start

Start VMs within a VMSS.

az vmss start --name
--resource-group
[--instance-ids]
[--no-wait]
[--subscription]

Examples

Start VMs within a VMSS. (autogenerated)

az vmss start --name MyScaleSet --resource-group MyResourceGroup

Required Parameters

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--resource-group -g

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

Optional Parameters

--instance-ids

Space-separated list of IDs (ex: 1 2 3 ...) or * for all instances. If not provided, the action will be applied on the scaleset itself.

--no-wait

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

--subscription

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

az vmss stop

Power off (stop) VMs within a VMSS.

az vmss stop --name
--resource-group
[--instance-ids]
[--no-wait]
[--skip-shutdown]
[--subscription]

Examples

Power off (stop) VMs within a VMSS. (autogenerated)

az vmss stop --name MyScaleSet --resource-group MyResourceGroup

Power off VMs within a VMSS without shutting down.

az vmss stop --name MyScaleSet --resource-group MyResourceGroup --skip-shutdown

Required Parameters

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--resource-group -g

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

Optional Parameters

--instance-ids

Space-separated list of IDs (ex: 1 2 3 ...) or * for all instances. If not provided, the action will be applied on the scaleset itself.

--no-wait

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

--skip-shutdown

Skip shutdown and power-off immediately.

--subscription

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

az vmss update

Update a VMSS.

az vmss update [--add]
[--force-string]
[--ids]
[--instance-id]
[--license-type {None, Windows_Client, Windows_Server}]
[--name]
[--no-wait]
[--protect-from-scale-in {false, true}]
[--protect-from-scale-set-actions {false, true}]
[--remove]
[--resource-group]
[--set]
[--subscription]

Examples

Update a VMSS. (autogenerated)

az vmss update --name MyScaleSet --resource-group MyResourceGroup --set virtualMachineProfile.storageProfile.imageReference.version=16.04.201801090

Update a VMSS' license type for Azure Hybrid Benefit.

az vmss update --name MyScaleSet --resource-group MyResourceGroup --license-type windows_server

Update a VM instance's protection policies.

az vmss update --name MyScaleSet --resource-group MyResourceGroup --instance-id 4             --protect-from-scale-set-actions False --protect-from-scale-in

Update a VM instance's protection policies.

az vmss update --name MyScaleSet --resource-group MyResourceGroup --instance-id 4             --set protectionPolicy.protectFromScaleIn=True protectionPolicy.protectFromScaleSetActions=False

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.

--instance-id

Update the VM instance with this ID. If missing, Update the VMSS.

--license-type

Specifies that the Windows image or disk was licensed on-premises. To enable Azure Hybrid Benefit for Windows Server, use 'Windows_Server'. To enable Multitenant Hosting Rights for Windows 10, use 'Windows_Client'. For more information see the Azure Windows VM online docs.

accepted values: None, Windows_Client, Windows_Server
--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--no-wait

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

--protect-from-scale-in

Protect the VM instance from scale-in operations.

accepted values: false, true
--protect-from-scale-set-actions

Protect the VM instance from scale set actions (including scale-in).

accepted values: false, true
--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.

az vmss update-instances

Upgrade VMs within a VMSS.

az vmss update-instances --instance-ids
--name
--resource-group
[--no-wait]
[--subscription]

Examples

Upgrade VMs within a VMSS. (autogenerated)

az vmss update-instances --instance-ids 1 --name MyScaleSet --resource-group MyResourceGroup

Required Parameters

--instance-ids

Space-separated list of IDs (ex: 1 2 3 ...) or * for all instances.

--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

--resource-group -g

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

Optional Parameters

--no-wait

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

--subscription

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

az vmss wait

Place the CLI in a waiting state until a condition of a scale set is met.

az vmss wait [--created]
[--custom]
[--deleted]
[--exists]
[--ids]
[--instance-id]
[--interval]
[--name]
[--resource-group]
[--subscription]
[--timeout]
[--updated]

Examples

Place the CLI in a waiting state until a condition of a scale set is met. (autogenerated)

az vmss wait --created --name MyScaleSet --resource-group MyResourceGroup

Place the CLI in a waiting state until the VMSS has been updated.

az vmss wait --updated --name MyScaleSet --resource-group MyResourceGroup

Place the CLI in a waiting state until the VMSS instance has been updated.

az vmss wait --updated --instance-id 1 --name MyScaleSet --resource-group MyResourceGroup

Optional Parameters

--created

Wait until created with 'provisioningState' at 'Succeeded'.

--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

--deleted

Wait until deleted.

--exists

Wait until the resource exists.

--ids

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

--instance-id

Wait on the VM instance with this ID. If missing, Wait on the VMSS.

--interval

Polling interval in seconds.

default value: 30
--name -n

Scale set name. You can configure the default using az configure --defaults vmss=<name>.

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

--timeout

Maximum wait in seconds.

default value: 3600
--updated

Wait until updated with provisioningState at 'Succeeded'.