This step-by-step how-to post will instruct you on how to resize an Azure virtual machine, including changing the size within a series or switching the virtual machine to another series.
I will discuss the actual process before I discuss two of the common problems that are commonly encountered and how to resolve them.
The typical process for resizing a virtual machine is pretty simple. I am going to add an extra step because it will avoid one of the common problems for you:
- Shut down the virtual machine
- Resize the virtual machine
- Start up the virtual machine
Step 1 is to deallocate the virtual machine. Sometimes you won’t need to do this, but all too often I hear this from a customer: “I want to switch to Series X, but it’s not available – what’s wrong?”. When the customer tries to switch to another series of virtual machine, the virtual machine’s current host cluster hardware doesn’t support the new series, so it’s not listed as an option. By deallocating the virtual machine (Azure shutdown, not a guest OS shutdown), all of the possible options in the region are made available, and the resize process will migrate the virtual machine to a new compute cluster. So as a result, I always recommend deallocating the virtual machine to avoid this question.
The next step is to resize the virtual machine. Open the virtual machine in the Azure portal and select Size under Settings. Search for and select the new size.
Resizing an existing Azure virtual machine [Image Credit: Aidan Finn]
A task will run to resize the virtual machine. This might take 20-30 seconds. In my example, I updated a virtual machine from a D2_v2 to a D2_v3 and the job was completed in under 20 seconds – note that this would have included a switch to new host hardware.
Next you will start the virtual machine. And that’s the job completed, all with just a few minutes of downtime. Now let’s talk about possible issues.
The Size I Want Is Not Listed
The current host hardware does not support the virtual machine series/size that you desire. Please see step 1 above and deallocate the virtual machine by shutting it down in the Azure Portal or by running Stop-AzureVM/Stop-AzureRMVM.
My Virtual Machine is in an Availability Set
You will modify the above process slightly because all of the virtual machines in the availability set must reside in the same compute (Hyper-V) cluster. Start by trying to resize the virtual machine without shutting it down (deallocating it) first. If the size you require is not listed, then you will have to modify the above process as follows:
- Deallocate all of the virtual machines in the availability set.
- Resize the required virtual machine(s).
- Resize all the remaining virtual machines in the availability set to match the capabilities of the compute cluster.
- Start all of the required virtual machines in the availability set.
The Virtual Machine Cannot Start Because of Quota
Every Azure subscription has default CPU quotas:
- Total virtual processors per region.
- Number of virtual processors per series in a region.
It doesn’t take much to hit the default quotas, which are there to protect you. You can see your usage versus the limits under Subscriptions > [Subscriptionb] > Usage + Quotas. If you hit a limit then you can request an increase from Microsoft using a free billing support ticket. Normally, a limit increase is allowed, but on rare occasions a hardware shortage might prevent Microsoft from immediately giving you what you request.
The Virtual Machine Cannot Resize Because of Policy
An owner of a subscription (or a tenant) can deploy Azure policies to a subscription or management group (containing subscriptions) to limit what kinds of virtual machines can be deployed. If your resize operation fails and the error lists a policy restriction, then you’ll have to talk to whomever manages Azure in your organization.