az vm
Manage Linux or Windows virtual machines.
Commands
az vm assess-patches |
Assess patches on a VM. |
az vm auto-shutdown |
Manage auto-shutdown for VM. |
az vm availability-set |
Group resources into availability sets. |
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 boot-diagnostics |
Troubleshoot the startup of an Azure Virtual Machine. |
az vm boot-diagnostics disable |
Disable the boot diagnostics on a VM. |
az vm boot-diagnostics enable |
Enable the boot diagnostics on a VM. |
az vm boot-diagnostics get-boot-log |
Get the boot diagnostics log from a VM. |
az vm boot-diagnostics get-boot-log-uris |
Get SAS URIs for a virtual machine's boot diagnostic logs. |
az vm capture |
Capture information for a stopped VM. |
az vm convert |
Convert a VM with unmanaged disks to use managed disks. |
az vm create |
Create an Azure Virtual Machine. |
az vm deallocate |
Deallocate a VM. |
az vm delete |
Delete a VM. |
az vm diagnostics |
Configure the Azure Virtual Machine diagnostics extension. |
az vm diagnostics get-default-config |
Get the default configuration settings for a VM. |
az vm diagnostics set |
Configure the Azure VM diagnostics extension. |
az vm disk |
Manage the managed data disks attached to a VM. |
az vm disk attach |
Attach a managed persistent disk to a VM. Please note that --ids only supports one disk. |
az vm disk detach |
Detach a managed disk from a VM. |
az vm encryption |
Manage encryption of VM disks. |
az vm encryption disable |
Disable disk encryption on the OS disk and/or data disks. Decrypt mounted disks. |
az vm encryption enable |
Enable disk encryption on the OS disk and/or data disks. Encrypt mounted disks. |
az vm encryption show |
Show encryption status. |
az vm extension |
Manage extensions on VMs. |
az vm extension delete |
Remove an extension attached to a VM. |
az vm extension image |
Find the available VM extensions for a subscription and region. |
az vm extension image list |
List the information on available extensions. |
az vm extension image list-names |
List the names of available extensions. |
az vm extension image list-versions |
List the versions for available extensions. |
az vm extension image show |
Display information for an extension. |
az vm extension list |
List the extensions attached to a VM. |
az vm extension set |
Set extensions for a VM. |
az vm extension show |
Display information about extensions attached to a VM. |
az vm extension wait |
Place the CLI in a waiting state until a condition of a virtual machine extension is met. |
az vm generalize |
Mark a VM as generalized, allowing it to be imaged for multiple deployments. |
az vm get-instance-view |
Get instance information about a VM. |
az vm host |
Manage Dedicated Hosts for Virtual Machines. |
az vm host create |
Create a dedicated host. |
az vm host delete |
Delete a dedicated host. |
az vm host get-instance-view |
Get instance information about a dedicated host. |
az vm host group |
Manage Dedicated Host Groups. |
az vm host group create |
Create a dedicated host group. |
az vm host group delete |
Delete a dedicated host group. |
az vm host group get-instance-view |
Get instance view of a dedicated host group. |
az vm host group list |
List dedicated host groups. |
az vm host group show |
Get the details of a dedicated host group. |
az vm host group update |
Update a dedicated host group. |
az vm host list |
List dedicated hosts. |
az vm host show |
Get the details of a dedicated host. |
az vm host update |
Update a dedicated host. |
az vm identity |
Manage service identities of a VM. |
az vm identity assign |
Enable managed service identity on a VM. |
az vm identity remove |
Remove managed service identities from a VM. |
az vm identity show |
Display VM's managed identity info. |
az vm image |
Information on available virtual machine images. |
az vm image accept-terms |
Accept Azure Marketplace term so that the image can be used to create VMs. |
az vm image list |
List the VM/VMSS images available in the Azure Marketplace. |
az vm image list-offers |
List the VM image offers available in the Azure Marketplace. |
az vm image list-publishers |
List the VM image publishers available in the Azure Marketplace. |
az vm image list-skus |
List the VM image SKUs available in the Azure Marketplace. |
az vm image show |
Get the details for a VM image available in the Azure Marketplace. |
az vm image terms |
Manage Azure Marketplace image terms. |
az vm image terms accept |
Accept Azure Marketplace image terms so that the image can be used to create VMs. |
az vm image terms cancel |
Cancel Azure Marketplace image terms. |
az vm image terms show |
Get the details of Azure Marketplace image terms. |
az vm list |
List details of Virtual Machines. |
az vm list-ip-addresses |
List IP addresses associated with a VM. |
az vm list-sizes |
List available sizes for VMs. |
az vm list-skus |
Get details for compute-related resource SKUs. |
az vm list-usage |
List available usage resources for VMs. |
az vm list-vm-resize-options |
List available resizing options for VMs. |
az vm monitor |
Manage monitor aspect for a vm. |
az vm monitor log |
Manage log analytics workspace for a vm. |
az vm monitor log show |
Execute a query against the Log Analytics workspace linked with a VM. |
az vm monitor metrics |
Manage metrics for a vm. |
az vm monitor metrics list-definitions |
List the metric definitions for a VM. |
az vm monitor metrics tail |
List the metric values for a VM. |
az vm nic |
Manage network interfaces. See also |
az vm nic add |
Add existing NICs to a VM. |
az vm nic list |
List the NICs available on a VM. |
az vm nic remove |
Remove NICs from a VM. |
az vm nic set |
Configure settings of a NIC attached to a VM. |
az vm nic show |
Display information for a NIC attached to a VM. |
az vm open-port |
Opens a VM to inbound traffic on specified ports. |
az vm perform-maintenance |
The operation to perform maintenance on a virtual machine. |
az vm reapply |
Reapply VMs. |
az vm redeploy |
Redeploy an existing VM. |
az vm resize |
Update a VM's size. |
az vm restart |
Restart VMs. |
az vm run-command |
Manage run commands on a Virtual Machine. |
az vm run-command invoke |
Execute a specific run command on a vm. |
az vm run-command list |
Lists all available run commands for a subscription in a location. |
az vm run-command show |
Gets specific run command for a subscription in a location. |
az vm secret |
Manage VM secrets. |
az vm secret add |
Add a secret to a VM. |
az vm secret format |
Transform secrets into a form that can be used by VMs and VMSSes. |
az vm secret list |
List secrets on a VM. |
az vm secret remove |
Remove a secret from a VM. |
az vm show |
Get the details of a VM. |
az vm simulate-eviction |
Simulate the eviction of a Spot VM. |
az vm start |
Start a stopped VM. |
az vm stop |
Power off (stop) a running VM. |
az vm unmanaged-disk |
Manage the unmanaged data disks attached to a VM. |
az vm unmanaged-disk attach |
Attach an unmanaged persistent disk to a VM. |
az vm unmanaged-disk detach |
Detach an unmanaged disk from a VM. |
az vm unmanaged-disk list |
List unmanaged disks of a VM. |
az vm update |
Update the properties of a VM. |
az vm user |
Manage user accounts for a VM. |
az vm user delete |
Delete a user account from a VM. |
az vm user reset-ssh |
Reset the SSH configuration on a VM. |
az vm user update |
Update a user account. |
az vm wait |
Place the CLI in a waiting state until a condition of the VM is met. |
az vm assess-patches
Assess patches on a VM.
az vm assess-patches [--ids]
[--name]
[--resource-group]
[--subscription]
Examples
Assess patches on a VM.
az vm assess-patches -g MyResourceGroup -n MyVm
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm auto-shutdown
Manage auto-shutdown for VM.
az vm auto-shutdown [--email]
[--ids]
[--location]
[--name]
[--off]
[--resource-group]
[--subscription]
[--time]
[--webhook]
Examples
Create auto-shutdown schedule for a VM.
az vm auto-shutdown -g MyResourceGroup -n MyVm --time 1730 --email "foo@bar.com" --webhook "https://example.com/"
Delete auto-shutdown schedule for a VM.
az vm auto-shutdown -g MyResourceGroup -n MyVm --off
Optional Parameters
The email recipient to send notifications to (can be a list of semi-colon separated email addresses).
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Turn off auto-shutdown for VM. Configuration will be cleared.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
The UTC time of day the schedule will occur every day. Format: hhmm. Example: 1730.
The webhook URL to which the notification will be sent.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm capture
Capture information for a stopped VM.
For an end-to-end tutorial, see https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-capture-image.
az vm capture --vhd-name-prefix
[--ids]
[--name]
[--overwrite]
[--resource-group]
[--storage-container]
[--subscription]
Examples
Deallocate, generalize, and capture a stopped virtual machine.
az vm deallocate -g MyResourceGroup -n MyVm
az vm generalize -g MyResourceGroup -n MyVm
az vm capture -g MyResourceGroup -n MyVm --vhd-name-prefix MyPrefix
Deallocate, generalize, and capture multiple stopped virtual machines.
vms_ids=$(az vm list -g MyResourceGroup --query "[].id" -o tsv)
az vm deallocate --ids {vms_ids}
az vm generalize --ids {vms_ids}
az vm capture --ids {vms_ids} --vhd-name-prefix MyPrefix
Required Parameters
The VHD name prefix specify for the VM disks.
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Overwrite the existing disk file.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The storage account container name in which to save the disks.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm convert
Convert a VM with unmanaged disks to use managed disks.
az vm convert [--ids]
[--name]
[--resource-group]
[--subscription]
Examples
Convert a VM with unmanaged disks to use managed disks.
az vm convert -g MyResourceGroup -n MyVm
Convert all VMs with unmanaged disks in a resource group to use managed disks.
az vm convert --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm create
Create an Azure Virtual Machine.
For an end-to-end tutorial, see https://docs.microsoft.com/azure/virtual-machines/linux/quick-create-cli.
az vm create --name
--resource-group
[--accelerated-networking {false, true}]
[--admin-password]
[--admin-username]
[--asgs]
[--assign-identity]
[--attach-data-disks]
[--attach-os-disk]
[--authentication-type {all, password, ssh}]
[--availability-set]
[--boot-diagnostics-storage]
[--computer-name]
[--custom-data]
[--data-disk-caching]
[--data-disk-encryption-sets]
[--data-disk-sizes-gb]
[--enable-agent {false, true}]
[--enable-auto-update {false, true}]
[--encryption-at-host {false, true}]
[--ephemeral-os-disk {false, true}]
[--eviction-policy {Deallocate, Delete}]
[--generate-ssh-keys]
[--host]
[--host-group]
[--image]
[--license-type {None, RHEL_BYOS, SLES_BYOS, Windows_Client, Windows_Server}]
[--location]
[--max-price]
[--nics]
[--no-wait]
[--nsg]
[--nsg-rule {NONE, RDP, SSH}]
[--os-disk-caching {None, ReadOnly, ReadWrite}]
[--os-disk-encryption-set]
[--os-disk-name]
[--os-disk-size-gb]
[--os-type {linux, windows}]
[--patch-mode {AutomaticByOS, AutomaticByPlatform, Manual}]
[--plan-name]
[--plan-product]
[--plan-promotion-code]
[--plan-publisher]
[--ppg]
[--priority {Low, Regular, Spot}]
[--private-ip-address]
[--public-ip-address]
[--public-ip-address-allocation {dynamic, static}]
[--public-ip-address-dns-name]
[--public-ip-sku {Basic, Standard}]
[--role]
[--scope]
[--secrets]
[--size]
[--specialized {false, true}]
[--ssh-dest-key-path]
[--ssh-key-values]
[--storage-account]
[--storage-container-name]
[--storage-sku]
[--subnet]
[--subnet-address-prefix]
[--subscription]
[--tags]
[--ultra-ssd-enabled {false, true}]
[--use-unmanaged-disk]
[--validate]
[--vmss]
[--vnet-address-prefix]
[--vnet-name]
[--workspace]
[--zone {1, 2, 3}]
Examples
Create a default Ubuntu VM with automatic SSH authentication.
az vm create -n MyVm -g MyResourceGroup --image UbuntuLTS
Create a default RedHat VM with automatic SSH authentication using an image URN.
az vm create -n MyVm -g MyResourceGroup --image RedHat:RHEL:7-RAW:7.4.2018010506
Create a default Windows Server VM with a private IP address.
az vm create -n MyVm -g MyResourceGroup --public-ip-address "" --image Win2012R2Datacenter
Create a VM from a custom managed image.
az vm create -g MyResourceGroup -n MyVm --image MyImage
Create a VM from a specialized image version.
az vm create -g MyResourceGroup -n MyVm --image $id --specialized
Create a VM by attaching to a managed operating system disk.
az vm create -g MyResourceGroup -n MyVm --attach-os-disk MyOsDisk --os-type linux
Create an Ubuntu Linux VM using a cloud-init script for configuration. See: https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init.
az vm create -g MyResourceGroup -n MyVm --image debian --custom-data MyCloudInitScript.yml
Create a Debian VM with SSH key authentication and a public DNS entry, located on an existing virtual network and availability set.
az vm create -n MyVm -g MyResourceGroup --image debian --vnet-name MyVnet --subnet subnet1 \
--availability-set MyAvailabilitySet --public-ip-address-dns-name MyUniqueDnsName \
--ssh-key-values @key-file
Create a simple Ubuntu Linux VM with a public IP address, DNS entry, two data disks (10GB and 20GB), and then generate ssh key pairs.
az vm create -n MyVm -g MyResourceGroup --public-ip-address-dns-name MyUniqueDnsName \
--image ubuntults --data-disk-sizes-gb 10 20 --size Standard_DS2_v2 \
--generate-ssh-keys
Create a Debian VM 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 vm create -g group-name -n vm-name --admin-username deploy \
--image debian --secrets "$vm_secrets"
Create a CentOS VM with a system assigned identity. The VM will have a 'Contributor' role with access to a storage account.
az vm create -n MyVm -g rg1 --image centos --assign-identity --scope /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/MyResourceGroup/myRG/providers/Microsoft.Storage/storageAccounts/storage1
Create a debian VM with a user assigned identity.
az vm create -n MyVm -g rg1 --image debian --assign-identity /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/resourcegroups/myRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myID
Create a debian VM with both system and user assigned identity.
az vm create -n MyVm -g rg1 --image debian --assign-identity [system] /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/resourcegroups/myRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myID
Create a VM in an availability zone in the current resource group's region
az vm create -n MyVm -g MyResourceGroup --image Centos --zone 1
Required Parameters
Name of the virtual machine.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Optional Parameters
Enable accelerated networking. Unless specified, CLI will enable it based on machine image and size.
Password for the VM if authentication type is 'Password'.
Username for the VM. Default value is current username of OS. If the default value is system reserved, then default value will be set to azureuser. Please refer to https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate#osprofile to get a full list of reserved values.
Space-separated list of existing application security groups to associate with the VM.
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.
Attach existing data disks to the VM. Can use the name or ID of a managed disk or the URI to an unmanaged disk VHD.
Attach an existing OS disk to the VM. Can use the name or ID of a managed disk or the URI to an unmanaged disk VHD.
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.
Name or ID of an existing availability set to add the VM to. None by default.
Pre-existing storage account name or its blob uri to capture boot diagnostics. Its sku should be one of Standard_GRS, Standard_LRS and Standard_RAGRS.
The host OS name of the virtual machine. Defaults to the name of the VM.
Custom init script file or text (cloud-init, cloud-config, etc..).
Storage caching type for data disk(s), including 'None', 'ReadOnly', 'ReadWrite', etc. Use a singular value to apply on all disks, or use <lun>=<vaule1> <lun>=<value2>
to configure individual disk.
Names or IDs (space delimited) of disk encryption sets for data disks.
Space-separated empty managed data disk sizes in GB to create.
Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later.
Indicate whether Automatic Updates is enabled for the Windows virtual machine.
Enable Host Encryption for the VM or VMSS. This will enable the encryption for all the disks including Resource/Temp disk at host itself.
Allows you to create an OS disk directly on the host node, providing local disk performance and faster VM/VMSS reimage time.
The eviction policy for the Spot priority virtual machine. Default eviction policy is Deallocate for a Spot priority virtual machine.
Generate SSH public and private key files if missing. The keys will be stored in the ~/.ssh directory.
ID of the dedicated host that the VM will reside in. --host and --host-group can't be used together.
Name or ID of the dedicated host group that the VM will reside in. --host and --host-group can't be used together.
The name of the operating system image as a URN alias, URN, custom image name or ID, custom image version ID, or VHD blob URI. This parameter is required unless using --attach-os-disk.
Valid URN format: "Publisher:Offer:Sku:Version". For more information, see https://docs.microsoft.com/azure/virtual-machines/linux/cli-ps-findimage.
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.
Location in which to create VM and related resources. If default location is not configured, will default to the resource group's location.
The maximum price (in US Dollars) you are willing to pay for a Spot VM/VMSS. -1 indicates that the Spot VM/VMSS should not be evicted for price reasons.
Names or IDs of existing NICs to attach to the VM. The first NIC will be designated as primary. If omitted, a new NIC will be created. If an existing NIC is specified, do not specify subnet, VNet, public IP or NSG.
Do not wait for the long-running operation to finish.
The name to use when creating a new Network Security Group (default) or referencing an existing one. Can also reference an existing NSG by ID or specify "" for none ('""' in Azure CLI using PowerShell or --% operator).
NSG rule to create when creating a new NSG. Defaults to open ports for allowing RDP on Windows and allowing SSH on Linux. NONE represents no NSG rule.
Storage caching type for the VM OS disk. Default: ReadWrite.
Name or ID of disk encryption set for OS disk.
The name of the new VM OS disk.
OS disk size in GB to create.
Type of OS installed on a custom VHD. Do not use when specifying an URN or URN alias.
Mode of in-guest patching to IaaS virtual machine. Possible values are: Manual - You control the application of patches to a virtual machine. You do this by applying patches manually inside the VM. In this mode, automatic updates are disabled; the paramater --enable-auto-update must be false. AutomaticByOS - The virtual machine will automatically be updated by the OS. The parameter --enable-auto-update must be true. AutomaticByPlatform - the virtual machine will automatically updated by the OS. The parameter --enable-agent and --enable-auto-update must be true.
Plan name.
Plan product.
Plan promotion code.
Plan publisher.
The name or ID of the proximity placement group the VM should be associated with.
Priority. Use 'Spot' to run short-lived workloads in a cost-effective way. 'Low' enum will be deprecated in the future. Please use 'Spot' to deploy Azure spot VM and/or VMSS. Default to Regular.
Static private IP address (e.g. 10.0.0.5).
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 ('""' in Azure CLI using PowerShell or --% operator).
Globally unique DNS name for a newly created public IP.
Public IP SKU. It is set to Basic by default.
Role name or id the system assigned identity will have.
Scope that the system assigned identity can access.
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)"}] }]
.
The VM size to be created. See https://azure.microsoft.com/pricing/details/virtual-machines/ for size info.
Indicate whether the source image is specialized.
Destination file path on the VM for the SSH key. If the file already exists, the specified key(s) are appended to the file. Destination path for SSH public keys is currently limited to its default value "/home/username/.ssh/authorized_keys" due to a known issue in Linux provisioning agent.
Space-separated list of SSH public keys or public key file paths.
Only applicable when used with --use-unmanaged-disk
. The name to use when creating a new storage account or referencing an existing one. If omitted, an appropriate storage account in the same resource group and location will be used, or a new one will be created.
Only applicable when used with --use-unmanaged-disk
. Name of the storage container for the VM OS disk. Default: vhds.
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.
The name of the subnet when creating a new VNet or referencing an existing one. Can also reference an existing subnet by ID. If both vnet-name and subnet are omitted, an appropriate VNet and subnet will be selected automatically, or a new one will be created.
The subnet IP address prefix to use when creating a new VNet in CIDR format.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Enables or disables the capability to have 1 or more managed data disks with UltraSSD_LRS storage account.
Do not use managed disk to persist VM.
Generate and validate the ARM template without creating any resources.
Name or ID of an existing virtual machine scale set that the virtual machine should be assigned to. None by default.
The IP address prefix to use when creating a new VNet in CIDR format.
Name of the virtual network when creating a new one or referencing an existing one.
Name or ID of Log Analytics Workspace. If you specify the workspace through its name, the workspace should be in the same resource group with the vm, otherwise a new workspace will be created.
Availability zone into which to provision the resource.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm deallocate
Deallocate a VM.
For an end-to-end tutorial, see https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-capture-image.
az vm deallocate [--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
Examples
Deallocate, generalize, and capture a stopped virtual machine.
az vm deallocate -g MyResourceGroup -n MyVm
az vm generalize -g MyResourceGroup -n MyVm
az vm capture -g MyResourceGroup -n MyVm --vhd-name-prefix MyPrefix
Deallocate, generalize, and capture multiple stopped virtual machines.
vms_ids=$(az vm list -g MyResourceGroup --query "[].id" -o tsv)
az vm deallocate --ids {vms_ids}
az vm generalize --ids {vms_ids}
az vm capture --ids {vms_ids} --vhd-name-prefix MyPrefix
Deallocate a VM. (autogenerated)
az vm deallocate --name MyVm --no-wait --resource-group MyResourceGroup
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm delete
Delete a VM.
az vm delete [--force-deletion]
[--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
[--yes]
Examples
Delete a VM without a prompt for confirmation.
az vm delete -g MyResourceGroup -n MyVm --yes
Delete all VMs in a resource group.
az vm delete --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
Optional Parameters
Optional parameter to force delete virtual machines.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Do not prompt for confirmation.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm generalize
Mark a VM as generalized, allowing it to be imaged for multiple deployments.
For an end-to-end tutorial, see https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-capture-image.
az vm generalize [--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
Examples
Deallocate, generalize, and capture a stopped virtual machine.
az vm deallocate -g MyResourceGroup -n MyVm
az vm generalize -g MyResourceGroup -n MyVm
az vm capture -g MyResourceGroup -n MyVm --vhd-name-prefix MyPrefix
Deallocate, generalize, and capture multiple stopped virtual machines.
vms_ids=$(az vm list -g MyResourceGroup --query "[].id" -o tsv)
az vm deallocate --ids {vms_ids}
az vm generalize --ids {vms_ids}
az vm capture --ids {vms_ids} --vhd-name-prefix MyPrefix
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm get-instance-view
Get instance information about a VM.
az vm get-instance-view [--ids]
[--name]
[--resource-group]
[--subscription]
Examples
Use a resource group and name to get instance view information of a VM.
az vm get-instance-view -g MyResourceGroup -n MyVm
Get instance views for all VMs in a resource group.
az vm get-instance-view --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm list
List details of Virtual Machines.
For more information on querying information about Virtual Machines, see https://docs.microsoft.com/cli/azure/query-az-cli2.
az vm list [--query-examples]
[--resource-group]
[--show-details]
[--subscription]
Examples
List all VMs.
az vm list
List all VMs by resource group.
az vm list -g MyResourceGroup
List all VMs by resource group with details.
az vm list -g MyResourceGroup -d
Optional Parameters
Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Show public ip address, FQDN, and power states. command will run slow.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm list-ip-addresses
List IP addresses associated with a VM.
az vm list-ip-addresses [--ids]
[--name]
[--resource-group]
[--subscription]
Examples
Get the IP addresses for a VM.
az vm list-ip-addresses -g MyResourceGroup -n MyVm
Get IP addresses for all VMs in a resource group.
az vm list-ip-addresses --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm list-sizes
List available sizes for VMs.
az vm list-sizes --location
[--subscription]
Examples
List the available VM sizes in the West US region.
az vm list-sizes -l westus
Required Parameters
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
.
Optional Parameters
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm list-skus
Get details for compute-related resource SKUs.
This command incorporates subscription level restriction, offering the most accurate information.
az vm list-skus [--all {false, true}]
[--location]
[--resource-type]
[--size]
[--subscription]
[--zone {false, true}]
Examples
List all SKUs in the West US region.
az vm list-skus -l westus
List all available vm sizes in the East US2 region which support availability zone.
az vm list-skus -l eastus2 --zone
List all available vm sizes in the East US2 region which support availability zone with name like "standard_ds1...".
az vm list-skus -l eastus2 --zone --size standard_ds1
List availability set related sku information in The West US region.
az vm list-skus -l westus --resource-type availabilitySets
Optional Parameters
Show all information including vm sizes not available under the current subscription.
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
.
Resource types e.g. "availabilitySets", "snapshots", "disks", etc.
Size name, partial name is accepted.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Show skus supporting availability zones.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm list-usage
List available usage resources for VMs.
az vm list-usage --location
[--subscription]
Examples
Get the compute resource usage for the West US region.
az vm list-usage -l westus
Required Parameters
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
.
Optional Parameters
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm list-vm-resize-options
List available resizing options for VMs.
az vm list-vm-resize-options [--ids]
[--name]
[--resource-group]
[--subscription]
Examples
List all available VM sizes for resizing.
az vm list-vm-resize-options -g MyResourceGroup -n MyVm
List available sizes for all VMs in a resource group.
az vm list-vm-resize-options --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm open-port
Opens a VM to inbound traffic on specified ports.
Adds a security rule to the network security group (NSG) that is attached to the VM's network interface (NIC) or subnet. The existing NSG will be used or a new one will be created. The rule name is 'open-port-{port}' and will overwrite an existing rule with this name. For multi-NIC VMs, or for more fine-grained control, use the appropriate network commands directly (nsg rule create, etc).
az vm open-port --port
[--apply-to-subnet]
[--ids]
[--name]
[--nsg-name]
[--priority]
[--resource-group]
[--subscription]
Examples
Open all ports on a VM to inbound traffic.
az vm open-port -g MyResourceGroup -n MyVm --port '*'
Open a range of ports on a VM to inbound traffic with the highest priority.
az vm open-port -g MyResourceGroup -n MyVm --port 80-100 --priority 100
Open all ports for all VMs in a resource group.
az vm open-port --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) --port '*'
Required Parameters
The port or port range (ex: 80-100) to open inbound traffic to. Use '*' to allow traffic to all ports.
Optional Parameters
Allow inbound traffic on the subnet instead of the NIC.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the virtual machine to open inbound traffic on.
The name of the network security group to create if one does not exist. Ignored if an NSG already exists.
Rule priority, between 100 (highest priority) and 4096 (lowest priority). Must be unique for each rule in the collection.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm perform-maintenance
The operation to perform maintenance on a virtual machine.
az vm perform-maintenance [--ids]
[--name]
[--resource-group]
[--subscription]
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm reapply
Reapply VMs.
az vm reapply [--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
Examples
Reapply a VM.
az vm reapply -g MyResourceGroup -n MyVm
Reapply all VMs in a resource group.
az vm reapply --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm redeploy
Redeploy an existing VM.
az vm redeploy [--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
Examples
Redeploy a VM.
az vm redeploy -g MyResourceGroup -n MyVm
Redeploy all VMs in a resource group.
az vm redeploy --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm resize
Update a VM's size.
az vm resize --size
[--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
Examples
Resize a VM.
az vm resize -g MyResourceGroup -n MyVm --size Standard_DS3_v2
Resize all VMs in a resource group.
az vm resize --size Standard_DS3_v2 --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
Required Parameters
The VM size.
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm restart
Restart VMs.
az vm restart [--force]
[--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
Examples
Restart a VM.
az vm restart -g MyResourceGroup -n MyVm
Restart all VMs in a resource group.
az vm restart --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
Optional Parameters
Force the VM to restart by redeploying it. Use if the VM is unresponsive.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm show
Get the details of a VM.
az vm show [--ids]
[--name]
[--query-examples]
[--resource-group]
[--show-details]
[--subscription]
Examples
Show information about a VM.
az vm show -g MyResourceGroup -n MyVm -d
Get the details for all VMs in a resource group.
az vm show -d --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Show public ip address, FQDN, and power states. command will run slow.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm simulate-eviction
Simulate the eviction of a Spot VM.
az vm simulate-eviction [--ids]
[--name]
[--resource-group]
[--subscription]
Examples
Simulate the eviction of a Spot VM.
az vm simulate-eviction --resource-group MyResourceGroup --name MyVm
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm start
Start a stopped VM.
az vm start [--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
Examples
Start a stopped VM.
az vm start -g MyResourceGroup -n MyVm
Start all VMs in a resource group.
az vm start --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
Start a stopped VM. (autogenerated)
az vm start --name MyVm --no-wait --resource-group MyResourceGroup
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm stop
Power off (stop) a running VM.
The VM will continue to be billed. To avoid this, you can deallocate the VM through "az vm deallocate".
az vm stop [--ids]
[--name]
[--no-wait]
[--resource-group]
[--skip-shutdown]
[--subscription]
Examples
Power off (stop) a running VM.
az vm stop --resource-group MyResourceGroup --name MyVm
Power off a running VM without shutting down.
az vm stop --resource-group MyResourceGroup --name MyVm --skip-shutdown
Power off VMs in a resource group.
az vm stop --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Skip shutdown and power-off immediately.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm update
Update the properties of a VM.
Update VM objects and properties using paths that correspond to 'az vm show'.
az vm update [--add]
[--disk-caching]
[--force-string]
[--ids]
[--license-type {None, RHEL_BYOS, RHEL_ELS_6, SLES_BYOS, Windows_Client, Windows_Server}]
[--max-price]
[--name]
[--no-wait]
[--os-disk]
[--ppg]
[--priority {Low, Regular, Spot}]
[--remove]
[--resource-group]
[--set]
[--subscription]
[--ultra-ssd-enabled {false, true}]
[--workspace]
[--write-accelerator]
Examples
Add or update a tag.
az vm update -n name -g group --set tags.tagName=tagValue
Remove a tag.
az vm update -n name -g group --remove tags.tagName
Set the primary NIC of a VM.
az vm update -n name -g group --set networkProfile.networkInterfaces[1].primary=false networkProfile.networkInterfaces[0].primary=true
Add a new non-primary NIC to a VM.
az vm update -n name -g group --add networkProfile.networkInterfaces primary=false id={NIC_ID}
Remove the fourth NIC from a VM.
az vm update -n name -g group --remove networkProfile.networkInterfaces 3
Optional Parameters
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>.
Use singular value to apply across, or specify individual disks, e.g. 'os=ReadWrite 0=None 1=ReadOnly' should enable update os disk and 2 data disks.
When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
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.
The maximum price (in US Dollars) you are willing to pay for a Spot VM/VMSS. -1 indicates that the Spot VM/VMSS should not be evicted for price reasons.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Do not wait for the long-running operation to finish.
Managed OS disk ID or name to swap to.
The name or ID of the proximity placement group the VM should be associated with.
Priority. Use 'Spot' to run short-lived workloads in a cost-effective way. 'Low' enum will be deprecated in the future. Please use 'Spot' to deploy Azure spot VM and/or VMSS. Default to Regular.
Remove a property or an element from a list. Example: --remove property.list
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Update an object by specifying a property path and value to set. Example: --set property1.property2=
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Enables or disables the capability to have 1 or more managed data disks with UltraSSD_LRS storage account.
Name or ID of Log Analytics Workspace. If you specify the workspace through its name, the workspace should be in the same resource group with the vm, otherwise a new workspace will be created.
Enable/disable disk write accelerator. Use singular value 'true/false' to apply across, or specify individual disks, e.g.'os=true 1=true 2=true' for os disk and data disks with lun of 1 & 2.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az vm wait
Place the CLI in a waiting state until a condition of the VM is met.
az vm wait [--created]
[--custom]
[--deleted]
[--exists]
[--ids]
[--interval]
[--name]
[--resource-group]
[--subscription]
[--timeout]
[--updated]
Examples
Wait until a VM is created.
az vm wait -g MyResourceGroup -n MyVm --created
Wait until all VMs in a resource group are deleted.
az vm wait --deleted --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)
Optional Parameters
Wait until created with 'provisioningState' at 'Succeeded'.
Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].
Wait until deleted.
Wait until the resource exists.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Polling interval in seconds.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Maximum wait in seconds.
Wait until updated with provisioningState at 'Succeeded'.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.