Resize a VM
In this task you'll change a VM's size.
If a VM is too slow, or bigger than it needs to be, you can change its size: more or fewer processors and more or less memory. The disks and settings stay the same.
Resizing restarts the VM. If the new size isn't available on the hardware the VM is running on, you have to stop (deallocate) it first, and then every size in the region is available.
Example. SS Kaiser's online shop VM struggles every December. The team resizes it to a bigger size for the sales season and back down in January, paying for the extra power only when they need it.
Before you start
You need: Virtual Machine Contributor or Contributor. Time: 10 minutes.
Where to look
- Virtual machines
- vm-practice
- Size
Steps
- Open vm-practice and select Size in the left menu.
- Look at the list, grouped by series: each size shows its vCPUs, memory and price, and the current size's series is marked Current.Display cost switches the price between monthly and hourly.
- To practise without leaving the free allowance, stop here and only look.Any size not marked as free-eligible costs money for every hour it runs.
- To try a resize, pick another size, such as B1ms, and select Resize. The VM restarts.Even a few minutes on a bigger size costs a few pence, so resize back straight away.
- Select B1s again and Resize to return to the free size.
- If a size is greyed out, stop (deallocate) the VM first, then try again.
Tip. Size is in the left menu under Availability + scale.
Commands
# Sizes this VM can move to without being deallocated
az vm list-vm-resize-options --resource-group rg-portal-practice --name vm-practice --output table
# Resize (the VM restarts)
az vm resize --resource-group rg-portal-practice --name vm-practice --size Standard_B1ms
# And back to the free-eligible size
az vm resize --resource-group rg-portal-practice --name vm-practice --size Standard_B1s
Watch out for
- Cost
- Bigger sizes cost more every hour, and leaving the free-eligible sizes means paying. Azure Advisor suggests smaller sizes for VMs that are mostly idle.
- Security
- Resizing doesn't change who can reach the VM, but the restart interrupts anyone using it. Warn users first.
- Common mistakes
- Resizing a busy server in the middle of the day. Forgetting to resize back after a test. Expecting the disk to grow too: disk size is changed separately.
Clean up
- Virtual machines
- vm-practice
- Size
Make sure the VM is back on B1s (or another free-eligible size). It's removed with the resource group at the end of this section.
Words to know
- B-series
- Low-cost sizes that build up credits when idle and use them for short bursts of work.
- Right-sizing
- Choosing the smallest size that does the job, to avoid paying for power you don't use.
Tick off each step and track your progress in the guide.
Open this task in Azure Portal, Hands On