Azure Virtual Machines – Scaling

Overview

Scaling lets you adjust the compute capacity of your Azure Virtual Machine (VM) workloads to match demand. Azure supports two primary scaling models:

  • Scale‑out (horizontal): Add or remove VM instances in a Virtual Machine Scale Set (VMSS).
  • Scale‑up (vertical): Change the size (CPU, memory) of an individual VM.

This guide covers manual scaling, autoscaling with Azure Monitor, and best‑practice recommendations.

Prerequisites

  • Azure subscription with Owner or Contributor rights.
  • Azure CLI 2.53+ or Azure PowerShell 12.0+ installed.
  • A VM or VM Scale Set already provisioned.
  • Azure Monitor enabled for autoscaling.

Scale‑out with Virtual Machine Scale Sets

Manual scaling via Azure Portal

  1. Navigate to Virtual Machine Scale Sets in the Azure portal.
  2. Select your scale set → ScalingInstance count.
  3. Enter the desired instance count and click Save.

Scale‑out using Azure CLI

Azure CLI
PowerShell
az vmss scale \
    --resource-group MyResourceGroup \
    --name MyScaleSet \
    --new-capacity 5

Autoscaling with Azure Monitor

Define autoscale rules based on metrics such as CPU percentage or queue length.

  1. Open the scale set → ScalingAutoscale.
  2. Create a new Autoscale Profile.
  3. Add a rule, for example: When CPU > 70% for 5 minutes, increase instance count by 1.
  4. Save the profile.

Scale‑up (Resize) a Virtual Machine

Portal method

  1. Go to Virtual Machines → select your VM.
  2. Click Size under Settings.
  3. Choose the new size and click Resize.

Resize with Azure CLI

az vm resize \
    --resource-group MyResourceGroup \
    --name MyVM \
    --size Standard_D4s_v3

Resize with PowerShell

Update-AzVM `
    -ResourceGroupName "MyResourceGroup" `
    -Name "MyVM" `
    -Size "Standard_D4s_v3"

Best Practices

  • Use VM Scale Sets for stateless workloads that can handle horizontal scaling.
  • Leverage Autoscale to reduce costs during idle periods.
  • Prefer Scale‑out over Scale‑up for higher availability.
  • Set upper and lower bounds on instance counts to prevent runaway scaling.
  • Monitor scaling actions with Azure Monitor logs and alerts.

FAQ

Can I mix scale‑out and scale‑up?
Yes. You can run a VMSS (scale‑out) and periodically resize individual VMs (scale‑up) based on workload needs.
How long does a resize operation take?
Typically 2‑5 minutes, depending on the VM size and underlying hardware.
Will scaling affect my IP address?
Scale‑out adds new instances with their own IPs. Scale‑up retains the original VM's IP unless you recreate the VM.