Azure Scaling Tutorial

Overview

Scaling in Azure lets you adjust resources to meet demand while optimizing cost. Azure supports both vertical (scale‑up) and horizontal (scale‑out) scaling, automatic rules, and manual controls.

Types of Scaling

Vertical Scaling (Scale‑Up)

Increase the size of a VM or service tier (e.g., from Standard_D2s_v3 to Standard_D8s_v3).

Horizontal Scaling (Scale‑Out)

Add more instances to a service pool, such as VM scale sets or App Service instances.

Auto‑Scaling

Define rules based on metrics (CPU, queue length) to automatically adjust instance count.

Manual Scaling

Use Azure Portal, CLI, or PowerShell to set instance counts directly.

Configure Auto‑Scaling

Below is a sample ARM template snippet for an Azure App Service auto‑scale rule.

{
  "type": "Microsoft.Insights/autoscaleSettings",
  "apiVersion": "2015-04-01",
  "name": "[concat(parameters('appName'),'/autoscale')]",
  "location": "[resourceGroup().location]",
  "properties": {
    "profiles": [
      {
        "name": "AutoScaleProfile",
        "capacity": {
          "minimum": "1",
          "maximum": "5",
          "default": "2"
        },
        "rules": [
          {
            "metricTrigger": {
              "metricName": "CpuPercentage",
              "metricNamespace": "Microsoft.Web/sites",
              "metricResourceUri": "[resourceId('Microsoft.Web/sites', parameters('appName'))]",
              "timeGrain": "PT1M",
              "statistic": "Average",
              "timeWindow": "PT5M",
              "timeAggregation": "Average",
              "operator": "GreaterThan",
              "threshold": 70
            },
            "scaleAction": {
              "direction": "Increase",
              "type": "ChangeCount",
              "value": "1",
              "cooldown": "PT5M"
            }
          },
          {
            "metricTrigger": {
              "metricName": "CpuPercentage",
              "metricNamespace": "Microsoft.Web/sites",
              "metricResourceUri": "[resourceId('Microsoft.Web/sites', parameters('appName'))]",
              "timeGrain": "PT1M",
              "statistic": "Average",
              "timeWindow": "PT5M",
              "timeAggregation": "Average",
              "operator": "LessThan",
              "threshold": 30
            },
            "scaleAction": {
              "direction": "Decrease",
              "type": "ChangeCount",
              "value": "1",
              "cooldown": "PT5M"
            }
          }
        ]
      }
    ]
  }
}

Scaling Calculator

Enter an average CPU load and desired instance count to see recommended scaling.

Best Practices