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.
Table of Contents
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_v2Before 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.

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.

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.

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.

You may also like following the articles below.

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
