az vm resize

This article will walk you through the syntax and usage of the az vm resize command with certain examples of how to use this command.

az vm resize

This command helps you to update the size of an Azure Virtual machine.

Syntax

az vm resize --size [--ids] [--name][--resource-group]

Example-1

The below command will resize the AzurelessonsNewVM to Standard_DS3_v2.

az vm resize -g newresgroup -n AzurelessonsNewVM --size Standard_DS3_v2

Before executing this command, I just logged in to the Azure Portal and verified that the current size of the Azure Virtual Machine is Standard B1ms(1 vcpu, 2GiB memory) as shown in the screenshot below.

az vm resize command

Let us execute the above command; I got the expected output, as shown below.

{
  "additionalCapabilities": {
    "hibernationEnabled": false,
    "ultraSsdEnabled": null
  },
  "applicationProfile": null,
  "availabilitySet": null,
  "billingProfile": null,
  "capacityReservation": null,
  "diagnosticsProfile": {
    "bootDiagnostics": {
      "enabled": true,
      "storageUri": null
    }
  },
  "etag": "\"27\"",
  "evictionPolicy": null,
  "extendedLocation": null,
  "extensionsTimeBudget": null,
  "hardwareProfile": {
    "vmSize": "Standard_DS3_v2",
    "vmSizeProperties": null
  },
  "host": null,
  "hostGroup": null,
  "id": "/subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/newresgroup/providers/Microsoft.Compute/virtualMachines/AzurelessonsNewVM",
  "identity": null,
  "instanceView": null,
  "licenseType": null,
  "location": "centralus",
  "managedBy": null,
  "name": "AzurelessonsNewVM",
  "networkProfile": {
    "networkApiVersion": null,
    "networkInterfaceConfigurations": null,
    "networkInterfaces": [
      {
        "deleteOption": "Detach",
        "id": "/subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/newresgroup/providers/Microsoft.Network/networkInterfaces/azurelessonsnewvm477_z1",
        "primary": null,
        "resourceGroup": "newresgroup"
      }
    ]
  },
  "osProfile": {
    "adminPassword": null,
    "adminUsername": "Rajkishore",
    "allowExtensionOperations": true,
    "computerName": "AzurelessonsNewVM",
    "customData": null,
    "linuxConfiguration": {
      "disablePasswordAuthentication": false,
      "enableVmAgentPlatformUpdates": null,
      "patchSettings": {
        "assessmentMode": "ImageDefault",
        "automaticByPlatformSettings": null,
        "patchMode": "ImageDefault"
      },
      "provisionVmAgent": true,
      "ssh": null
    },
    "requireGuestProvisionSignal": true,
    "secrets": [],
    "windowsConfiguration": null
  },
  "plan": null,
  "platformFaultDomain": null,
  "priority": null,
  "provisioningState": "Succeeded",
  "proximityPlacementGroup": null,
  "resourceGroup": "newresgroup",
  "resources": null,
  "scheduledEventsPolicy": null,
  "scheduledEventsProfile": null,
  "securityProfile": {
    "encryptionAtHost": null,
    "encryptionIdentity": null,
    "proxyAgentSettings": null,
    "securityType": "TrustedLaunch",
    "uefiSettings": {
      "secureBootEnabled": true,
      "vTpmEnabled": true
    }
  },
  "storageProfile": {
    "dataDisks": [],
    "diskControllerType": "SCSI",
    "imageReference": {
      "communityGalleryImageId": null,
      "exactVersion": "20.04.202501110",
      "id": null,
      "offer": "0001-com-ubuntu-server-focal",
      "publisher": "canonical",
      "sharedGalleryImageId": null,
      "sku": "20_04-lts-gen2",
      "version": "latest"
    },
    "osDisk": {
      "caching": "ReadWrite",
      "createOption": "FromImage",
      "deleteOption": "Delete",
      "diffDiskSettings": null,
      "diskSizeGb": null,
      "encryptionSettings": null,
      "image": null,
      "managedDisk": {
        "diskEncryptionSet": null,
        "id": "/subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/NEWRESGROUP/providers/Microsoft.Compute/disks/AzurelessonsNewVM_OsDisk_1_3ded8e6ecd4a4ff39343f870c03502cf",
        "resourceGroup": "NEWRESGROUP",
        "securityProfile": null,
        "storageAccountType": null
      },
      "name": "AzurelessonsNewVM_OsDisk_1_3ded8e6ecd4a4ff39343f870c03502cf",
      "osType": "Linux",
      "vhd": null,
      "writeAcceleratorEnabled": null
    }
  },
  "tags": null,
  "timeCreated": "2025-02-04T06:19:34.034169+00:00",
  "type": "Microsoft.Compute/virtualMachines",
  "userData": null,
  "virtualMachineScaleSet": null,
  "vmId": "6d1499c4-8557-408d-b9f8-2ab25fcd34d0",
  "zones": [
    "1"
  ]
}

You can see the same output in the below screenshot.

az vm resize

Now, again, I cross-checked the size of the virtual machine, and the VM size has been successfully changed to Standard_DS3_v2, as shown in the screenshot below.

az vm resize PowerShell

Example-2

We can also execute the below command to resize all the Virtual machines to Standard_DS3_v2 under the newresgroup Resource Group.

az vm resize --size Standard_DS3_v2 --ids $(az vm list -g newresgroup --query "[].id" -o tsv)

After executing the above command, I got the expected output, as shown in the screenshot below.

az vm resize Azure CLI command

You may also like following the articles below.

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!