How to Resize VM in AZURE

How to Resize VM in AZURE

Azure Virtual Machines (VM) is on-demand, scalable, computing resources provided by Microsoft Azure as IAAS. Most of the cloud service providers like AWS and Google provide IAAS related to meet infrastructure demands. Virtual Machine is needed to have more control over the computing environment.

Azure VM gives you the flexibility of virtualization without maintaining a physical machine. Since these services are provided as infrastructure as service so it needs to be maintained after creation. Azure VM used in all environments like Development/Test/QA and Productions as well depending on your requirements.

As you are aware Virtual Machine is the core part of Azure Cloud IAAS offers. Various models of virtual machines provided in an ARM to fulfill all the requirements of different categories of application deployments. The size determines the number of computing resources such as CPU, GPU, and memory that are made available to the virtual machine. VM needs to be sized appropriately for the expected workload.

Of per main advantages of cloud services, it’s scalability. In either case like workload increases, wrong provisioning, or script based deployment in your organization you can resize your VM whenever required.

Obviously, there are many ways to do the same task but here we would like to go through the most common one GUI-based method via Azure Portal and CLI based. Let’s go through some basics first which will help to understand more about the targeted task. 

Different Category of Virtual Machines in Azure

Below is the list of VM categories provided by Microsoft AZURE. It can be seen in either Microsoft documentation or you can get it via CLI.different category of virtual machines in Azure

How to find available VM sizes in using Azure CLI

To find out available VM sizes in a specific location using CLI via command az vm list-sizes command. The sample truncated output is as below.

# az vm list-sizes –location eastus –output table how to find available VM sizes in Azure

How to Start or Stop VM using Azure CLI

We can start or stop VM using az vm start/az vm stop . Please refer to the below snap.

How to get VM Power States using Azure CLI

Before resizing let us see in which state your VM should be. VM may be in various states. There are many ways how you can find the current status of VM. Windows SA will love to use Azure PowerShell while Unix SA will love using Azure CLI most of the time.

In case if you want from GUI Azure Web Portal is your best friend in most of the cases. It depends on which way you would like to achieve the same objective, you can use any and it is true for all the changes/modifications or setup. Below is the snap for various virtual machine status.

How to get the current status of VM via Azure CLI

How to find the IP Address of Virtual Machine in using Azure CLI





Now we have more clarity to deal with few operations that can be done for Virtual Machine. Let’s move to our main topic how to resize virtual machines in AZURE.

How to Correct VM Size in AZURE

As mentioned above let’s see how to resize virtual machines in AZURE using two methods via the web portal or CLI.

(A ) How to Correct or Resize Virtual Machine Size in AZURE using Web Portal

1. log in to Azure Web Console using using your credentials. You will have a console like below.

Azure Web Portal Main Page

2.  Click on Virtual Machine from the left panel of the console. Please see below.

Azure Web Portal Virtual Machine Page























3.  You will get a screen like below which will give you the option to search based on your subscription. You can type your VM name which you need to resize. Once you find your VM click on it. It will open VM.

4.  On VM Screen like below. If new VM size in the same cluster or another cluster. VM is expected to be rebooted in either case so it is always better to place VM in a deallocated state. You can achieve by taking the Stop option on this screen.

Once Stop completed you can see VM status as deallocated. Please be careful and make sure VM is in a stopped/deallocated state before proceeding the next step.

5.  Select Size Option here (it is from the same specific VM as step 4.)

Azure Web Portal Virtual Machine Size Page














6. You will have the below screen based on your subscription.If your target VM type is visible select VM and takes the below option. Else you can find from here if your machine type is not visible. Finally, take the Resize option and let the resize task completed. This resize option is visible down to machine type.Azure Web Portal Virtual Machine Size Availability Page












7.  Go to VM Screen described in Step 4 and start the VM. Let the task completed. You can log in and validate and see the current VM type on the same screen. It may take a few minutes to reflect. You can refresh the screen as well to see the current VM type.

That’s all for this topic as of now.

Let’s see how we can achieve the same via CLI.

(B ) How to Correct or Resize Virtual Machine in AZURE using Azure CLI

1. log in to your Azure CLI using the procedure you have. Considering you have all your access intact and you have VM Contributor role to your profile.

2.  Before resizing VM, you need to check if the required size VM is available on the current Azure cluster. You can use the az vm list-vm-resize-options command.


3.  If required VM size is available in the cluster, VM can be resized in the powered-on state of VM, anyhow VM will be rebooted during the operation. You can use az vm resize command to resize.


4.  If the desired VM size is not in the cluster you see in step 2 above, VM needs to be deallocated before the resize VM. You can use az vm deallocate command to stop and deallocate the VM.


Note: When VM is powered back on, data on the temp disk may be removed. The public IP address also changes unless a static IP address is being used. If you are using static IP you need not worry.

How to Deallocate Virtual Machine in Azure

5.Resize can be done once VM is in a deallocated state using az vm resize command as below.



6.  Start VM once resize completed and validate once available.




That’s all for this topic as of now. Hope this will be helpful…


Thanks for keep going through the above procedure.If you like you can subscribe to our newsletter to get the latest tips, tricks, and how-to steps to accomplish specific tasks. Please do not hesitate to share this with all possible social accounts where ever you have a presence.