Virtual Machine Scale Sets in Azure

Virtual Machine Scale Sets in Azure

A friendly, deep walk through the Azure service that runs many identical virtual machines as one smart group: it grows when traffic rises, shrinks when traffic falls, and heals itself when something breaks.

Picture a small pizza shop with one oven. On a quiet Tuesday, one oven is plenty. Then Friday night arrives, a big cricket match ends, and two hundred hungry people walk in at the same time. One oven cannot keep up. Orders pile up, customers leave angry, and the owner loses money.

Now imagine the opposite mistake. The owner buys twenty ovens just in case. On Tuesday, nineteen ovens sit cold, yet the owner still pays rent and electricity for every one of them. Both choices hurt. The smart choice is to have exactly the right number of ovens for the crowd that is in the shop right now.

Websites, mobile app back ends, and data processing jobs face this exact problem every single day. Azure Virtual Machine Scale Sets, usually shortened to VMSS, are Microsoft’s answer. You describe one server once, and Azure runs as many copies as you need, adds more when the crowd grows, removes them when the crowd goes home, and replaces any copy that breaks. In this guide you will learn what a scale set is, how it works inside, how to keep it safe, fast, and affordable, and how to avoid the mistakes that catch most beginners.

1What Is a Virtual Machine Scale Set?

A scale set is a manager for a group of identical virtual machines. Once you understand that one sentence, everything else in this guide becomes easy.

Start with a virtual machine

A virtual machine, or VM, is a computer that exists as software. Microsoft owns enormous buildings full of real servers, called data centers. Azure cuts one real server into several virtual slices, and each slice behaves like a normal computer. It has its own operating system, its own memory, its own disk, and its own network address.

You rent a slice for as long as you need it. When you are done, you give it back and stop paying for the compute. That is the basic idea behind renting computers in the cloud instead of buying them.

Now add the words “scale set”

A Virtual Machine Scale Set is an Azure resource that creates and manages a whole group of virtual machines for you. You give it one description, and it builds the group from that description. Every machine in the group is called an instance. All instances start from the same disk image, use the same machine size, and run the same software.

Because the instances are identical, the group can be resized easily. Need five instances? Azure creates five. Traffic doubles? Ask for ten, or let Azure decide automatically. Traffic drops at midnight? Go back to three. You manage the group as one thing instead of logging in to each machine by hand.

Analogy

Think of a taxi company with a dispatch center. The dispatch center does not hire each driver one by one for each trip. It keeps the right number of identical, ready-to-drive taxis on the road. During the morning rush it sends out more. At three in the morning it keeps only a few. If one taxi breaks down, dispatch quietly sends a replacement. The scale set is the dispatch center, and the instances are the taxis.

$0
extra fee for the scale set itself. You pay only for the VMs, disks, and network pieces it creates
1,000
instances, the upper limit for a single scale set
3
availability zones that supported regions let you spread across

What a scale set gives you

  • Many identical VMs from one recipe. No more building servers by hand.
  • Manual or automatic resizing. You can change the count yourself or write rules that do it for you.
  • Spreading across failure boundaries. Instances can sit in different zones and fault domains so one problem does not take everything down.
  • Safe updates. You can roll a new software version across the group in small batches.
  • Self-healing. A broken instance can be detected and replaced automatically.
  • Friendly with load balancers. Traffic can be shared across all healthy instances.

What a scale set does not do

A scale set does not write your application. It does not magically turn a program that stores important data on its own disk into a program that is safe to copy. It is also not a container orchestrator like Kubernetes. It manages virtual machines, not containers, although Azure Kubernetes Service itself uses scale sets underneath to run its worker machines.

i
Remember this

A scale set is not a special kind of VM. It is a manager that keeps a group of normal VMs in the shape you asked for.

2Why Scale Sets Exist

Before cloud scaling tools, running a busy application meant guessing, waiting, and hoping. Understanding the old pain makes the new tool easier to appreciate.

The guessing game of fixed servers

In the old world, a company bought servers months before it needed them. Someone had to guess next year’s traffic. If the guess was too low, the website crashed on its busiest day. If the guess was too high, expensive machines sat idle for years. Nobody could guess perfectly, so everybody wasted money or lost customers.

The cloud fixed part of this because you can rent machines in minutes. But renting machines one by one still leaves a big problem. Somebody has to notice the traffic spike, click the buttons, install the software, and add the new machine to the load balancer. By then the spike may already be over.

Analogy

Imagine a supermarket with ten checkout counters but only one cashier on duty, no matter how long the line is. A smart manager opens more counters when the line grows and closes them when it shrinks. A scale set is that smart manager for your servers.

The “snowflake server” problem

When people build servers by hand, each one ends up slightly different. One has a newer library. Another has a forgotten setting. A third has a secret fix that only one engineer remembers. These one-of-a-kind machines are called snowflake servers because no two are alike. They are hard to repair and scary to replace.

Scale sets push you the other way. Every instance is built from the same image and the same settings, so any instance can be thrown away and rebuilt in minutes. That habit is the foundation of reliable cloud systems.

The single point of failure problem

One server means one thing that can break. Hardware fails, software crashes, and data centers occasionally lose power or cooling. If your whole application lives on one machine, any of those events means downtime. A group of instances spread across separate failure boundaries keeps the lights on even when one part goes dark.

Where the pressure shows up

Online shopping sales

Traffic during a festival sale can be many times higher than a normal day, but only for a few hours. A scale set adds capacity for the sale and removes it afterward.

Exam result portals

When results are announced, thousands of students open the site in the same minute. Capacity is needed urgently, then almost nothing is needed the next week.

Nightly data crunching

A company processes the day’s orders every night. A scale set can grow to fifty machines at 1 a.m., finish quickly, and shrink back to zero extra machines by morning.

Build and test machines

Software teams need many temporary machines to run tests at the same moment. Scale sets can create them on demand and delete them when the work is done.

Pay for the crowd you have, not the crowd you fear.

3Core Concepts and Vocabulary

Every technology has its own words. Learn these twelve and the Azure documentation will stop feeling like a foreign language.

Each term below is explained the same way: what it is, why it exists, and a simple picture to help you remember it.

Building block

Instance

One virtual machine inside the scale set. It is like one taxi in the fleet. Instances come and go, so never treat them as precious.

The recipe

Scale set model

The saved description of what each instance should look like: image, size, disk type, network, and extensions. Like a recipe card the kitchen follows.

Starting point

Image

A frozen copy of an operating system, and often your software too. New instances start from it, like photocopies of one master page.

Muscle size

VM size (SKU)

The amount of CPU, memory, and network power for each instance. A small size is a bicycle, a large size is a truck.

The count

Capacity

How many instances exist right now. Changing capacity is what “scaling” means.

Management style

Orchestration mode

Either Flexible or Uniform. It decides how much control you have over each instance and how mixed the group can be.

Failure boundary

Fault domain

A group of machines sharing power and network gear inside one data center. Spreading across fault domains means one rack failing does not hurt everyone.

Bigger boundary

Availability zone

A physically separate data center building within a region, with its own power, cooling, and networking. Spreading across zones survives a whole building problem.

Update rule

Upgrade policy

The rule for how changes reach existing instances: manual, automatic, or rolling in small batches.

Heartbeat

Health probe or health extension

A small check that asks each instance, “Are you okay?” The answer decides whether it gets traffic or gets repaired.

The brain

Autoscale setting

A set of rules in Azure Monitor that raises or lowers capacity based on numbers like CPU use or on a time schedule.

Helper software

Extension

A small add-on that runs on the instance during creation, such as installing your app or a monitoring agent.

Analogy

The scale set model is a cookie cutter. The image is the dough. Every cookie that comes out has the same shape and taste. If you change the cutter, new cookies change shape, but cookies already baked stay as they were until you choose to bake them again. That exact idea matters a lot when we talk about updates later.

Model versus instance

Azure keeps two ideas apart. The model is what the group is supposed to look like. Each instance is what actually exists. After you change the model, older instances may no longer match it. Azure can tell you which instances are on the latest model and which are behind. You then decide how and when to bring them up to date.

?
Good to know

A scale set is created inside one region, such as Central India or West Europe. It cannot stretch across two regions. If you want protection from a whole region failing, you run separate scale sets in separate regions and place a global traffic service in front of them.

4Architecture and Components

A scale set never works alone. It sits in the middle of a small city of Azure services that bring traffic in, store data, hold secrets, and watch everything.

flowchart TD
    U["Users on the Internet"] --> LB["Load Balancer or Application Gateway"]
    LB --> I1["Instance 1 in Zone 1"]
    LB --> I2["Instance 2 in Zone 2"]
    LB --> I3["Instance 3 in Zone 3"]
    subgraph VMSS["Virtual Machine Scale Set"]
        I1
        I2
        I3
    end
    GAL["Azure Compute Gallery image version"] -->|"image source"| VMSS
    MON["Azure Monitor metrics"] -->|"CPU and traffic numbers"| AS["Autoscale rules"]
    AS -->|"add or remove instances"| VMSS
    VMSS -->|"logs and metrics"| MON
    VMSS --> DB["Database and storage"]
    KV["Key Vault"] -.->|"secrets through managed identity"| VMSS
    
Figure 1: The main pieces around a scale set, from users on the left to data on the right

Read the diagram from the top. Users reach a front door, which is a load balancer or an application gateway. The front door shares requests across the instances. The instances sit in different zones so that one building problem does not stop everything. Behind the instances sit the databases and storage that keep long-lived data. Around the group, Azure Monitor watches numbers, autoscale rules react to those numbers, an image gallery supplies the starting disk, and Key Vault hands out secrets safely.

The compute layer

This is the scale set and its instances. Each instance has an operating system disk, a virtual network card, and the extensions you configured. The compute layer is where your code actually runs.

The network layer

Instances live inside a virtual network, often shortened to VNet, which is your private neighborhood in Azure. Inside it, subnets split the neighborhood into streets. Network security groups act like guards at the street entrances, allowing or blocking traffic by rule. A load balancer or application gateway spreads incoming requests over healthy instances.

The storage layer

Every instance needs an OS disk. You can use a normal managed disk that lives in Azure Storage, or an ephemeral OS disk that lives on the host machine’s local storage. Ephemeral disks are faster and free of separate disk charges, but their contents vanish when the instance is deleted or moved. They suit stateless instances well. If an instance needs to keep data, you attach data disks or, better, store the data in a database or storage account outside the scale set.

The image source

Instances start from either a ready-made platform image, like Ubuntu or Windows Server from Azure’s marketplace, or your own custom image kept in an Azure Compute Gallery. The gallery stores numbered image versions and can copy them to many regions, which makes consistent rollouts possible.

Identity and secrets

Instances can be given a managed identity, which is a name tag Azure itself maintains. With it, your code can prove who it is to services like Key Vault or Storage without any password stored on the machine.

The watching layer

Azure Monitor collects numbers such as CPU use and network traffic. Log Analytics stores logs for searching. Alerts tell people or systems when something looks wrong. Autoscale reads these numbers to decide whether to add or remove instances.

Analogy

A scale set is like a chain of identical coffee shops inside one shopping mall. The mall entrance staff direct people to shops with free seats (the load balancer). The head office keeps one recipe book (the image). A manager watches the queues and opens more shops when needed (autoscale). The bank vault holds the shared cash box keys (Key Vault), and the central warehouse stores supplies that must never be lost (the database).

5Flexible and Uniform Orchestration Modes

When you create a scale set, Azure asks you to pick a mode. This choice shapes almost everything you can do later, so it deserves its own chapter.

Uniform orchestration

Uniform mode is the original design. Every instance is built from the same scale set model. The scale set owns the instances tightly, and you mostly manage the group as a whole rather than touching individual machines. It is simple and predictable, and it works well for large groups of truly identical, stateless workers.

Flexible orchestration

Flexible mode is the newer design, and Microsoft recommends it for new deployments. Instances in Flexible mode look and behave much more like ordinary Azure VMs. You can add and remove individual machines, mix different VM sizes, spread them across zones and fault domains with more control, and blend regular and Spot machines in one group. It brings the best of both worlds: scale set automation with VM-level freedom.

Analogy

Uniform mode is an army parade where everyone wears the same uniform and does the same drill. Flexible mode is a well-run restaurant staff: the same company rules apply, but you can have cooks, waiters, and cleaners of different strengths working side by side.

QuestionUniformFlexible
Are all instances the same?Yes, strictly one modelSame model by default, with room for different sizes
Can I manage one instance on its own?Limited, mostly group-level actionsYes, instances behave like regular VMs
Can I mix regular and Spot VMs?NoYes, with a Spot priority mix
Spread across zones and fault domainsSupportedSupported, with spreading choices
Recommended for new projectsOnly when you have a specific reasonYes, this is the default recommendation

How to choose

For a new project, start with Flexible unless a feature you need is only available in Uniform. Check the current Azure documentation for the latest feature comparison, because Microsoft keeps closing the gaps. If you have an existing Uniform scale set that works well, there is no emergency to move it, but plan the move when you next redesign the system.

!
Watch out

The orchestration mode is chosen when the scale set is created and cannot simply be flipped later. Choosing quickly and fixing later can mean building a new scale set and moving traffic over to it.

6How a Scale Set Works Inside

Behind the friendly portal sits a steady loop that compares what you asked for with what exists, and fixes any difference.

Desired state: the thermostat idea

A home thermostat does not heat the room once and walk away. It keeps checking the temperature. If the room is colder than the number you set, it turns the heater on. If it is warmer, it turns it off. A scale set works the same way. You declare a desired state, for example “six healthy instances built from image version 4”. Azure keeps comparing the real world to that wish and takes action whenever they differ.

Analogy

You set the thermostat to 24 degrees. You do not tell it how to cool the room. You only describe the result you want. In the same way, you tell Azure “I want six instances” and Azure works out the creating, placing, starting, and replacing.

What happens when you create or grow a scale set

1

The request arrives at Azure Resource Manager

Every change in Azure goes through this front door. It checks who you are, whether you are allowed to do this, and whether the request makes sense.

2

The compute service records the desired state

The model and the requested capacity are saved. From now on, Azure’s compute service is responsible for making reality match the record.

3

Quota and capacity are checked

Your subscription has limits on how many virtual CPUs you may use in each region and each VM family. Azure also needs real free hardware of the requested type. If either is missing, the request fails.

4

Azure picks places for the new instances

The platform finds host machines with room, respecting your zone and fault domain spreading choices so that instances do not all land in one risky spot.

5

Disks and network cards are created

An OS disk is made from the image, either as a managed disk or as an ephemeral disk on the host. Each instance gets a network card with an address from your subnet and joins the load balancer’s backend pool if you configured one.

6

The instance boots and extensions run

A small Azure agent inside the machine runs your extensions in order: install the app, start the monitoring agent, start the health reporter.

7

Health passes and traffic begins

Once the health check reports success, the load balancer sends real requests to the new instance.

Why this loop matters

Because the platform keeps comparing wish and reality, a deleted or crashed instance can be noticed and rebuilt when automatic repair is turned on. You are no longer the one watching the machines. The platform is.

!
Common surprise

Scaling out can fail even when your rules are perfect. If your subscription quota is full, or the region has run low on a popular VM size at that moment, the new instances will not appear. Request quota increases before big events, and consider capacity reservations for must-have capacity.

7Autoscaling: Letting Azure Decide the Count

Autoscaling is the feature most people come to scale sets for. It turns “I hope we have enough servers” into a set of clear rules.

Autoscale belongs to Azure Monitor

The scale set itself only knows how to hold a number of instances. The brain that changes the number is Azure Monitor autoscale. You attach an autoscale setting to the scale set, and it keeps reading numbers and adjusting capacity within limits you choose.

Three styles of scaling

Reactive

Metric-based

React to live numbers. If average CPU stays high for several minutes, add instances. If it stays low, remove some.

Planned

Schedule-based

Change capacity at known times. Raise the count before office hours start, lower it at night, and raise it for a known sale day.

Forecast

Predictive

Azure studies past CPU patterns and adds capacity slightly before the usual rush, so new instances are warm when users arrive.

The parts of a rule

A metric rule is a plain sentence: “If the average of this number, over this much time, is above or below this value, then change the count by this amount, and then wait this long before acting again.” Each part has a job.

  • Metric: the number being watched, such as average CPU, memory pressure, network traffic, or a queue length.
  • Time window: how many minutes of data to average. A longer window ignores short spikes.
  • Threshold: the line that triggers the rule.
  • Action: add or remove a fixed number or a percentage of instances.
  • Cooldown: a rest period after a scaling action, so new instances have time to start and affect the numbers before the next decision.
  • Limits: a minimum, a maximum, and a default count. The minimum protects availability, and the maximum protects your wallet.
RuleConditionActionCooldown
Scale outAverage CPU above 70 percent for 10 minutesAdd 2 instances5 minutes
Scale inAverage CPU below 30 percent for 15 minutesRemove 1 instance10 minutes
LimitsMinimum 3, maximum 30, default 4Never go outside these numbersNot applicable

Scaling on what really matters

CPU is an easy number, but it is not always the right one. A worker that reads jobs from a queue should scale on how many jobs are waiting. A web server may care more about requests per second or response time. Autoscale can use custom numbers from tools like Application Insights, or queue lengths from services like Azure Storage queues and Service Bus. Pick the number that best predicts user pain.

The flapping trap

Imagine rules that add an instance at 70 percent CPU and remove one at 60 percent. Add one instance, and CPU drops to 58 percent. The rule removes it, CPU jumps to 72, and the cycle repeats forever. This back-and-forth is called flapping. Azure tries to predict the result of a scale-in action and skips it if it would immediately trigger a scale-out, but you should still leave a wide gap between your two thresholds.

Choosing who goes first when shrinking

When the count must go down, Azure has to choose which instances to delete. The scale-in policy controls this. The default policy balances instances across zones and fault domains first, then removes the instance with the highest ID. Other policies remove the newest or the oldest instance first. You can also protect specific instances from being chosen, which is useful when one machine is busy finishing a long task.

i
Golden rule

Scale out fast, scale in slow. Adding capacity late hurts users right away. Removing capacity a little late only costs a few extra minutes of rent.

Analogy

A good restaurant manager calls extra waiters the moment the entrance queue grows, but sends them home only after the dinner crowd has clearly gone. Sending staff home too quickly means calling them back again twenty minutes later, which wastes everyone’s time.

8Data Flow and Instance Lifecycle

Two journeys matter here: the journey of one user request through the system, and the journey of one instance from birth to deletion.

The journey of a scale-out

Let us follow a busy afternoon. Traffic rises, CPU climbs, and the scale set grows from four instances to six. The picture below shows who talks to whom.

sequenceDiagram
    participant M as Azure Monitor
    participant A as Autoscale Engine
    participant C as Compute Control Plane
    participant H as Host Servers
    participant L as Load Balancer
    M->>A: Average CPU is 82 percent
    A->>A: Check the rule and the cooldown timer
    A->>C: Raise capacity from 4 to 6
    C->>H: Create two instances from the model
    H-->>C: Instances are running
    C->>L: Add new instances to the backend pool
    L->>L: Health probe passes on both
    L-->>M: Traffic now shared by six instances
    
Figure 2: What happens, step by step, when autoscale adds two instances

Notice that the load balancer waits for the health probe before sending real users to a new instance. This small pause is why a half-started machine does not serve errors to customers. It is also why a slow-starting application can make scale-out feel late: the new instance exists, but it is not ready to help yet.

The journey of one user request

A user types your address into a browser. A name system turns the name into the address of your front door. The load balancer or application gateway receives the request and picks one healthy instance, using a simple rule such as spreading requests evenly. The instance runs your code, perhaps asks a database or cache for data, builds an answer, and sends it back along the same path. The user never knows which instance answered, and that is exactly the point: any instance can answer any request, so instances can come and go freely.

The life of one instance

flowchart LR
    P["Capacity requested"] --> CR["Creating"] --> ST["Starting and running extensions"] --> RU["Running and healthy"]
    RU --> UP["Updating or reimaging"] --> RU
    RU --> UH["Unhealthy"] --> RE["Repair by restart or replace"] --> RU
    RU --> SI["Chosen for scale in"] --> DE["Deleting"] --> GO["Gone"]
    RU --> EV["Spot eviction notice"] --> DE
    
Figure 3: The main states an instance can pass through

An instance is born when capacity is requested. It spends a short time creating and starting, and then it works for as long as it stays healthy. During its working life it may be updated, repaired, or even replaced. Eventually it is chosen for removal during a scale-in, or evicted because it was a Spot machine and Azure needed the space back, and then it is deleted. Good designs treat this whole story as normal weather rather than an emergency.

Getting a warning before the end

Azure can send an instance a short warning that something is about to happen. The warning is delivered through the Instance Metadata Service, a tiny web address that only the instance itself can reach. For scale-in, you can turn on a terminate notification, which delays the actual deletion by a few minutes so your application can finish current work, say goodbye to the load balancer, and save any last details. Spot instances receive a similar warning, but it is much shorter, around thirty seconds.

Analogy

A hotel does not throw a guest out in the middle of a shower. It rings the room and says, “Checkout is in ten minutes.” The terminate notification is that phone call. A guest who ignores the call gets removed anyway, so use the time wisely.

i
Design tip

Make your application finish in-flight requests and stop accepting new ones as soon as it receives a shutdown warning. This simple habit prevents most “random errors during scale-in” complaints.

9High Availability and Reliability

The goal of a scale set is not only to handle more traffic. It is also to keep serving users when parts of the system fail.

Failure comes in layers

Things break at different sizes. A single program can crash. A single physical server can fail. A rack of servers can lose its power connection. A whole data center building can lose cooling. An entire region can have a rare, large outage. Good design asks, “What is the biggest failure I want to survive?” and then spreads instances so that failure cannot take them all at once.

Small failure

Crashed instance

Handled by health checks and automatic repair. The bad instance is restarted or replaced.

Medium failure

Rack or host problem

Handled by spreading instances across fault domains, so a shared power or network problem hits only a part of the group.

Large failure

Data center building

Handled by spreading instances across availability zones, which are separate buildings in the same region.

Huge failure

Whole region

Handled by running a second scale set in another region, with a global traffic service that can shift users away.

Fault domains and availability zones

A fault domain groups machines that share the same power source and network switch inside a data center. An availability zone is a whole separate building with independent power, cooling, and network. Zones are farther apart than fault domains, so they protect against bigger problems. In regions that offer zones, spreading a scale set across all three is the strongest protection inside one region.

Analogy

Do not keep all your savings in one cupboard. Putting money in different drawers helps if a drawer sticks (fault domains). Putting some in a bank across town helps if your home floods (availability zones). Putting some in another city helps if the whole town is cut off (regions).

Spreading choices in Flexible mode

In Flexible mode you choose how strictly Azure spreads instances. Max spreading puts instances across as many fault domains as possible, giving the best protection. Static fixed spreading uses a fixed number of fault domains, which can suit workloads that need predictable grouping. For most web workloads, the zone spread with max spreading is a sensible starting point.

Automatic instance repairs

If you provide health information, Azure can watch each instance and fix the unhealthy ones without waking anyone up. Health can come from the load balancer’s probe or from the Application Health extension, a small helper that checks a web address or port inside the instance. When an instance stays unhealthy for longer than a grace period, Azure takes a repair action, such as restarting it, rebuilding it from the image, or replacing it entirely.

The grace period matters. A new instance needs time to boot and warm up. If the grace period is too short, Azure may keep killing instances that were simply still starting, causing a loop of endless replacement. Choose a period longer than your slowest normal startup.

What availability promise does Azure make?

Microsoft publishes a service level agreement for virtual machines. In general, running two or more instances spread across two or more availability zones gives the highest promised availability figure, higher than running in a single zone. The exact numbers can change, so always read the current Azure service level agreement page before quoting a number in a contract or design document.

Beyond one region

A scale set cannot span regions, so a regional failure plan uses separate scale sets with a global entry point such as Azure Front Door or Azure Traffic Manager. These services check which regions are healthy and send users only to those. Data is the hard part: the database must also be copied across regions, using the replication features of the database service you choose.

!
Do not forget

Spreading instances across zones helps nothing if the database behind them lives in just one zone. A chain is only as strong as its weakest link, so check every dependency.

10Updates, Upgrades, and Image Management

Releasing a new version of your software to fifty machines without breaking the site is its own craft. Scale sets give you built-in tools for it.

Two kinds of change

Some changes affect the model, such as a new image version, a new VM size, or a new extension setting. Other changes are inside the instance, such as an operating system patch. For model changes, existing instances do not update by themselves unless your upgrade policy says so. The upgrade policy is the rule that controls this.

PolicyWhat it doesBest for
ManualNothing changes until you choose instances and upgrade them yourselfCareful control, small groups, testing
AutomaticAzure upgrades all instances without waiting, possibly at the same timeNon-critical groups where brief disruption is fine
RollingAzure upgrades in small batches and pauses between them to check healthProduction web and service workloads

How a rolling upgrade works

1

Azure picks a small batch

For example, twenty percent of instances. The batch size is a setting you choose.

2

The batch is upgraded

The instances are updated or rebuilt from the new image while the rest of the group keeps serving users.

3

Azure waits and checks health

It pauses for a time you choose and confirms the upgraded instances are healthy through the load balancer probe or health extension.

4

The next batch begins, or the upgrade stops

If too many instances are unhealthy beyond your limits, Azure stops the rollout and leaves the remaining instances untouched, which protects most of your capacity.

Analogy

Repainting a long bridge does not mean closing the whole bridge. You close one lane at a time, paint it, let it dry, check it, and then move to the next lane. Traffic keeps flowing on the other lanes the whole time. A rolling upgrade is lane-by-lane repainting.

Extra safety with surge

Some rolling upgrade settings let Azure create new instances first and remove old ones afterward. This is called surging. Capacity never drops below the target during the upgrade, which is helpful when every instance is already working hard.

Automatic operating system image upgrades

When you use a supported platform image, Azure can automatically move your instances to a newer version of that image when Microsoft publishes security fixes. It uses the same rolling method and relies on health signals to stay safe. This takes a lot of patching work off your plate, but you should test new image versions in a staging group first when your application is sensitive.

Your own images and the Azure Compute Gallery

Many teams bake their software into a custom image so instances start ready to work. Building the image once and starting many instances from it is called the immutable image approach: you never fix a running instance, you build a new image and replace the old ones. The Azure Compute Gallery stores numbered versions, replicates them to the regions where you need them, and lets you share them across teams. You can also keep several versions side by side, which makes going back to a previous version easy.

Protecting special instances

Instance protection lets you mark an instance so it is skipped during scale-in, or during scale set actions like upgrades. Use it sparingly, for example while an instance is finishing a long job. Remember to remove the protection afterward, or the instance will quietly fall behind.

i
Release habit

Always keep the previous image version. If the new version misbehaves, switching the model back to the old version and rolling it out is the fastest, calmest rollback.

11Networking and Load Balancing

Instances are useless if users cannot reach them, and dangerous if everyone can. Networking decides who gets in, who gets out, and how work is shared.

Choosing a front door

ServiceWorks atGood for
Azure Load Balancer (Standard)Network level, fast and simpleAny TCP or UDP traffic, very high throughput, zone-redundant frontends
Application GatewayWeb level, understands URLs and headersWebsites and APIs, path-based routing, web application firewall, certificate handling
Azure Front DoorGlobal web entry pointUsers in many countries, caching, global failover across regions
Traffic ManagerName system levelSimple global routing between regions
Analogy

A network load balancer is a traffic policeman who waves each car to a free road without asking where it is going. An application gateway is a receptionist who reads the visitor’s card and sends them to the right department. A global front door is the airport that sends travelers to the right city first.

Health probes decide who gets traffic

A load balancer regularly asks each instance a simple question, such as “Does your web page answer on port 80?” Instances that answer correctly stay in rotation. Instances that fail are skipped until they recover. A good probe checks something meaningful, such as a small page that touches the application’s key dependencies, not just whether the machine is switched on.

Reaching individual instances

Sometimes you need to reach one particular instance for troubleshooting. Inbound NAT rules on a load balancer can map a port to a single instance. A better modern habit is to avoid direct logins altogether and use a controlled service such as Azure Bastion, which gives secure access through the browser without exposing the instance to the open internet.

Going out to the internet

Instances often need to reach the outside world to download updates or call other services. Azure has been moving away from giving new networks an invisible default way out to the internet, because hidden paths are hard to control. You should plan outbound access on purpose, using a NAT Gateway, load balancer outbound rules, or a firewall. A NAT Gateway gives all instances in a subnet a stable, shared public address, which is helpful when partners need to allow your address on their own lists.

Speed features

  • Accelerated networking lets the network card talk more directly to the physical hardware, lowering delay and lifting throughput. It needs a supported VM size and operating system.
  • Proximity placement groups ask Azure to place instances physically close together, which reduces delay between them for chatty workloads, with the trade-off of less spreading.
  • Private endpoints let instances reach services such as storage and databases over private addresses instead of the public internet.

Subnets and security rules

Place scale set instances in their own subnet so you can attach clear rules to it. A network security group on that subnet might allow web traffic only from the load balancer, allow management traffic only from the Bastion subnet, and deny everything else. Think of it as writing a short guest list for a private party.

!
Avoid

Giving every instance its own public IP address is rarely a good idea. It multiplies the number of doors that attackers can try. Keep instances private and let one well-guarded front door take the traffic.

12Security

A fleet of identical machines is a big advantage for defenders, because one fix reaches all of them. It is also a risk, because one mistake is copied everywhere.

Build in layers

No single control is perfect, so good security stacks several. If one layer fails, the next one still stands. Think of a castle with a moat, a wall, guards, and a locked inner room.

Identity

Managed identities

Let instances prove who they are to Key Vault, Storage, and databases without any password written on disk or in code.

Secrets

Key Vault

Keep passwords, keys, and certificates in a vault. Instances fetch them when needed instead of carrying them inside the image.

Boot safety

Trusted launch

Secure boot and a virtual security chip help ensure the instance starts only with trusted software, which blocks many deep-level attacks.

Data safety

Disk encryption

Encrypt disks, and consider encryption at host so even temporary data and caches are protected on the physical machine.

Network

Private subnets and NSGs

Keep instances off the public internet and allow only the traffic you really expect.

Access

Role-based access control

Give people only the permissions they need. Someone who watches dashboards does not need power to delete the scale set.

Patching at fleet scale

Old software is the easiest way in for attackers. With scale sets you have two healthy patching styles. In the immutable style, you build a fresh image with the latest fixes and roll it out, which keeps every instance identical. In the in-place style, a service such as Azure Update Manager applies patches to running instances on a schedule. The immutable style is cleaner and easier to reason about. The in-place style may fit when instances are long-lived by necessity.

Watch for risky configuration

Microsoft Defender for Cloud checks your scale sets and tells you about weak spots, such as open management ports, missing patches, or unencrypted disks. Azure Policy can enforce rules automatically, for example “all scale sets must use zones” or “no public IP addresses on instances”, so mistakes are stopped before they reach production.

Analogy

A school keeps its main gate locked, gives each teacher a name badge, stores exam papers in a safe, and checks every visitor at the office. No single rule is enough, but together they make trouble very hard. Layered security for scale sets follows the same idea.

!
Never do this

Never bake passwords, private keys, or access tokens into a custom image. Every instance gets a copy, and anyone who can read the image can read the secret. Fetch secrets at run time from a vault using a managed identity.

13Cost Optimization

Scale sets make it easy to spend exactly what you need. They also make it easy to spend a lot very quickly if nobody is watching.

What you actually pay for

The scale set service itself is free. You pay for the pieces it creates: the virtual machines by the time they run, the disks, the load balancer, public addresses, outbound data transfer, and monitoring data you store. Understanding this list helps you find where savings hide.

LeverHow it saves moneyWatch out for
Autoscale with a sensible minimumPay only for needed instancesA minimum set too high wastes money all night
Schedule-based scale downShrink test and development groups in the evening and on weekendsForgotten schedules that scale down production
Spot instancesLarge discounts on spare capacity for interruption-tolerant workInstances can be taken away with short notice
Reservations and savings plansCommit to steady usage for a long term in exchange for lower pricesCommitting to more than your steady base
Azure Hybrid BenefitUse existing eligible Windows or SQL licensesLicense rules must be followed carefully
Right-sizingPick a VM size that matches real CPU and memory useOver-shrinking causes slow responses
Ephemeral OS disksAvoid separate OS disk charges for stateless instancesDisk contents vanish when instances are deleted

Spot instances in a scale set

Azure sometimes has machines nobody is using. It rents those spare machines at a big discount as Spot instances, with one condition: Azure may take them back when it needs the space, or when the market price passes the maximum you set. You choose what happens on eviction, either deleting the instance or stopping it so the disk is kept.

In Flexible mode you can mix regular and Spot instances using a Spot priority mix. For example, you can keep a base number of regular instances for safety and fill the rest with Spot instances for savings. If Spot instances disappear, the regular base keeps serving users, and the scale set tries to refill capacity.

Good fits for Spot

  • Batch processing that can retry failed tasks
  • Video rendering and image conversion
  • Test and build machines
  • Stateless workers reading from a queue

Poor fits for Spot

  • The only database server
  • Single-instance tools that must never stop
  • Work with strict deadlines and no spare capacity
  • Anything that loses data when stopped without warning

Cost safety rails

Set a maximum instance count so a runaway rule or an attack cannot create a thousand machines. Add budgets and cost alerts in Azure Cost Management. Tag each scale set with the team and project that own it, so the monthly bill can be understood instead of guessed.

Analogy

Think of electricity at home. You keep a few lights on all night because you always need them (reserved base capacity). You switch on extra lights only when guests come (autoscale). And you buy cheaper off-peak power for the washing machine whenever the timing does not matter (Spot).

14Monitoring, Logging, and Metrics

You cannot fix what you cannot see. With dozens of short-lived instances, good visibility is not a luxury, it is the only way to know what is happening.

Three kinds of signals

Numbers

Metrics

Small numbers measured over time, like CPU percentage and network bytes. They are cheap, fast, and perfect for autoscale and alerts.

Text

Logs

Detailed records of events, such as errors and requests. They answer “what exactly happened?” and are stored in Log Analytics for searching.

Journeys

Traces

The path of one request across many services. Application Insights can record them to show where time is spent.

What to collect

Azure collects basic host-level metrics automatically, such as CPU percentage, disk activity, and network traffic, as seen from outside the instance. For deeper numbers from inside the operating system, like memory use and process counts, install the Azure Monitor Agent, which replaced the older monitoring agents. It sends guest metrics and logs to Azure Monitor and Log Analytics according to rules you define.

What to watchWhy it mattersUseful alert
CPU percentageMain clue for compute pressure and autoscale decisionsSustained high CPU near the maximum count
Memory availableCPU can look fine while memory runs outLow available memory for several minutes
Instance countShows whether scaling follows loadCount stuck at the maximum limit
Health stateTells you how many instances can actually serveFewer healthy instances than the minimum
Request rate and errorsShows what users really feelError rate above your normal level
Response timeSlow answers often come before outright failureSlow responses at the ninety-fifth percentile
Autoscale actionsReveals flapping, failed scale-outs, and quota problemsScale operation failed

Four golden signals for a scale set

Site reliability engineers often watch four things: latency (how long answers take), traffic (how many requests arrive), errors (how many requests fail), and saturation (how full the machines are). If you chart only these four across your scale set, you will catch most real problems early.

Logs that survive the instance

Instances disappear, and their local disks disappear with them. If logs stay only on the instance, the evidence is gone exactly when you need it most. Ship logs off the machine continuously, to Log Analytics or another central store, so you can still investigate an instance that was deleted an hour ago. Also enable boot diagnostics, which keeps startup screenshots and serial output for instances that fail to start.

Alerts that help instead of annoy

An alert should tell a person to do something. Alert on symptoms users feel, like high error rates, and on conditions that need action, like the scale set sitting at its maximum for an hour. Too many noisy alerts teach people to ignore them. Send alerts to the right people through action groups, and link each alert to a short runbook explaining what to check first.

Analogy

Hospital monitors track heart rate, blood pressure, and oxygen, and they sound an alarm when something goes wrong. But the doctor also reads the patient’s detailed chart to understand why. Metrics are the monitors, logs are the chart, and alerts are the alarm.

i
Practical tip

Review the autoscale activity history after each big traffic event. It shows exactly when scaling happened, what triggered it, and whether any action failed, which makes it the best teacher for tuning your rules.

15Scale Sets Compared with Other Azure Options

Scale sets are powerful, but they are not always the right tool. Knowing the neighbors helps you choose with confidence.

OptionWhat you manageScalingChoose it when
Single virtual machineOne machine, fullyManual resize onlyA small tool, a lab, or a legacy app that cannot run as copies
Virtual Machine Scale SetOperating system, runtime, and app on a group of VMsManual, scheduled, metric-based, predictiveYou need full machine control with automatic growth and healing
Azure App ServiceOnly your application codeBuilt-in autoscaleA standard web app or API and you do not want to manage servers
Azure Kubernetes ServiceContainers and cluster settingsPod and node scaling (node pools use scale sets)Many containerized microservices that need rich orchestration
Azure Container AppsContainers, without cluster managementEvent-driven, can scale to zeroContainer workloads with simple operations and bursty traffic
Azure FunctionsSmall pieces of codeAutomatic, per eventShort event-driven tasks and glue logic
Azure BatchJobs and tasks on pools of machinesPool-based, job-drivenLarge parallel compute jobs such as simulations and rendering

A simple way to decide

Ask what you want to stop worrying about. If the answer is “everything below my code”, look at App Service, Container Apps, or Functions. If you want to avoid the machine but run containers, look at Container Apps or Kubernetes. If you truly need to control the operating system, install special software, use a specific machine size, or lift an existing application with little change, a scale set is the right fit.

Analogy

Think about getting around a city. Owning a car is flexible but you handle fuel, repairs, and parking (a single VM). Running your own small taxi fleet gives you full control of every vehicle (a scale set). Booking a ride-hailing service lets you ignore the vehicles and only name the destination (App Service or Functions).

Scale sets are underneath many Azure services

Even if you choose a higher-level service, scale sets often work behind the scenes. Azure Kubernetes Service worker nodes run on scale sets. Azure Service Fabric uses them for its node types. Azure Pipelines can use scale set agents to create build machines on demand. Learning how scale sets behave helps you troubleshoot all of these.

16Design Patterns and Anti-Patterns

Patterns are proven recipes. Anti-patterns are recipes that look tasty and then make everyone sick.

Patterns worth copying

Pattern

Stateless web tier

Keep no important data on the instance. Sessions, uploads, and records live in a database, cache, or storage service, so any instance can answer any request and any instance can be deleted safely.

Pattern

Immutable images

Bake the application into an image, replace instances instead of editing them, and keep every instance identical. Rollbacks become a simple model change.

Pattern

Queue-based workers

Place jobs in a queue and let a scale set of workers pull from it. Scale on queue length, and a sudden pile of jobs turns into extra workers automatically.

Pattern

Blue and green groups

Run the old version (blue) and the new version (green) as two scale sets. Move traffic to green gradually and keep blue ready for a quick return.

Pattern

Base plus burst

Keep a small reserved base for steady load, and add Spot or autoscaled instances for peaks. You get safety and savings together.

Pattern

Scheduled capacity

When traffic follows a known calendar, such as office hours or sale days, use schedules to prepare capacity before the crowd arrives instead of reacting late.

Analogy

The stateless pattern is like a food court where every counter can serve any customer because the order system is shared in the middle. If one counter closes, the line just moves to another. Compare that with a tiny shop where only one person knows everyone’s orders: if that person goes home sick, the shop stops.

Anti-patterns to avoid

ANTI-PATTERN 01 · THE PET SERVER Avoid
What it looks like

Engineers log in to individual instances to fix settings by hand, install a tool “just for now”, or store important files on the local disk.

Why it hurts

The next scale-out creates instances without those hand-made changes, so the group becomes inconsistent. When the pet instance is deleted, its data and secret fixes are lost forever.

Do this instead

Put every change in the image or in a startup script, keep data in external services, and treat instance deletion as normal.

ANTI-PATTERN 02 · THE SINGLE-ZONE FLEET Avoid
What it looks like

Twenty instances are running happily, all in one zone, because it was the default during setup.

Why it hurts

A single zone problem takes down the entire application at once, even though you pay for twenty machines.

Do this instead

Spread across at least two zones, preferably three, in regions that support them, and confirm the dependencies behind the fleet are also zone-aware.

ANTI-PATTERN 03 · THE TRIGGER-HAPPY SCALER Avoid
What it looks like

Scale-out and scale-in thresholds sit close together, the cooldown is short, and the metric window is only one or two minutes.

Why it hurts

The group flaps up and down all day. Users meet instances that are still starting, and the bill grows because of constant creation and deletion.

Do this instead

Leave a wide gap between thresholds, use a longer window, add a sensible cooldown, and scale in more slowly than you scale out.

ANTI-PATTERN 04 · NO HEALTH SIGNAL Avoid
What it looks like

The load balancer probe only checks that a port is open, and automatic repairs and rolling upgrades are not configured.

Why it hurts

An instance whose application has frozen still looks alive. It keeps getting traffic and returning errors, and a rolling upgrade cannot tell good batches from bad ones.

Do this instead

Expose a real health endpoint that checks the application and its key dependencies, and connect it to probes, repairs, and upgrades.

17Best Practices and Common Mistakes

Most scale set problems come from a small set of repeating mistakes. Learn them once and save yourself many late nights.

Best practices checklist

  • Start with Flexible orchestration for new projects unless a specific feature needs Uniform.
  • Design for statelessness. Keep sessions, files, and records outside the instance.
  • Use zones. Spread across zones wherever the region offers them.
  • Automate image builds. Build images in a pipeline, version them in the Azure Compute Gallery, and keep previous versions for rollback.
  • Give instances health signals and connect them to the load balancer, repairs, and rolling upgrades.
  • Pick scaling metrics that mirror user pain, such as queue length or request rate, not only CPU.
  • Set minimum and maximum counts that protect both availability and budget.
  • Keep instances private and use managed identities, Key Vault, and a well-guarded front door.
  • Ship logs and metrics off the instance from the first day.
  • Describe everything as code, using templates or infrastructure-as-code tools, so environments can be rebuilt and reviewed like software.
  • Test scaling before the big day. Run a load test that pushes the group through scale-out and scale-in, and watch what breaks.

Mistakes beginners make

Forgetting the warm-up time

The app takes four minutes to start, but the autoscale rule only looks at one minute of data. New instances arrive after the rush has already hurt users. Start scaling earlier, use predictive or scheduled scaling for known peaks, and make startup faster by baking more into the image.

Hitting quota on the worst possible day

The scale set tries to grow but the subscription has no more vCPU quota in that region. Check your quota and request increases well before events.

Scaling the front end but not the back end

The web tier grows to fifty instances, then the database collapses under fifty times the connections. Scale sets help only the tier they manage, so test the whole chain together.

Keeping session data in memory

A user logs in on instance 3 and the next request lands on instance 5, which has never heard of them. Use a shared cache or a database for sessions, or tokens that carry their own proof.

Letting a bad image roll out everywhere

A new image has a bug, and an automatic upgrade pushes it to every instance within minutes. Use rolling upgrades with health checks, test in staging first, and keep the rollback image handy.

Ignoring the maximum count

A bug creates endless requests and the scale set grows until it hits a limit nobody chose, or until the budget is gone. Set a deliberate maximum and an alert when the group stays near it.

i
A quick self-test

Pick any instance in your scale set and imagine deleting it right now. If anything important would be lost, or if users would see errors, you have found a weakness worth fixing today.

18Real-World Usage

Some of the best examples of scale sets are inside Azure itself. Others are patterns you will see in almost every company that runs on the cloud.

Scale sets behind Azure services

Azure Kubernetes Service node pools

When you add worker nodes to an Azure Kubernetes Service cluster, those nodes are normally instances of a scale set. Cluster autoscaling adds or removes nodes by changing the scale set’s capacity, which is the same capacity idea you learned in this guide.

Azure Service Fabric node types

Service Fabric, Microsoft’s platform for building distributed services, uses scale sets to provide its node types. Each node type maps to a scale set, which gives it growth, zone spreading, and repairs.

Azure Pipelines scale set agents

Software teams use scale sets as pools of build agents. When many builds are queued, the pool creates machines. When the queue is empty, it shrinks, so the team pays only while builds are actually running.

Common company scenarios

The following examples describe typical situations rather than specific companies, because the exact designs of real businesses are private. They show how teams usually combine scale sets with other Azure services.

An online retailer during a festival sale

A shopping site keeps a base of reserved instances across three zones, uses an application gateway with a web application firewall, and schedules extra capacity thirty minutes before the sale begins. Autoscale handles any surprise beyond the plan. Sessions live in a managed cache, orders live in a database, and images live in storage, so instances stay disposable.

A media company converting video

Uploaded videos are placed in a queue. A scale set of Spot instances pulls jobs, converts them into several resolutions, and writes results to storage. If Azure takes a Spot instance back, the job returns to the queue and another worker finishes it. Costs stay low because the workers exist only while the queue has work.

A bank-style internal service

An internal payments service runs on a private scale set with no public addresses, spread over three zones, using trusted launch images, managed identities, and private endpoints to its database. Rolling upgrades with strict health limits protect it, and every change passes through an automated pipeline with approvals.

A school or exam portal

An education board’s result website sees almost no traffic for months, then enormous traffic in a single hour. The team scales out ahead of time with a schedule, uses a content delivery network for static pages, and returns to the small base once the rush ends.

A game studio running match servers

Online games need many short-lived servers near players. A scale set can add game servers as more matches start and remove them when players leave, with protection on instances that still have a match in progress.

The best scale set is the one nobody talks about, because it quietly keeps the right number of machines running.

19Capacity, Quotas, and Limits

Cloud capacity feels endless, but it has edges. Knowing where the edges are keeps your scale-out from failing at the worst moment.

Quota: your permission slip

Every Azure subscription has quotas, which are limits on how many virtual CPU cores you may use in each region. There are limits for the region as a whole and for each VM family, such as general purpose or memory optimized. Quotas exist to protect you from accidental runaway spending and to help Microsoft plan its hardware.

If your scale set tries to grow beyond your quota, the extra instances are simply not created, and the operation records an error. The fix is to ask for a higher quota before you need it. Many requests are approved quickly, but large ones can take time, so never leave this for the morning of a big launch.

Analogy

Quota is like a library card that allows you to borrow ten books at a time. Even if the library has thousands of books on the shelves, the eleventh book is refused until your card is upgraded. Capacity, on the other hand, is whether the library actually has a free copy of the book on its shelf right now.

Capacity: the hardware must really exist

Quota gives you permission, but a region must also have free machines of the exact size you ask for. Popular sizes in busy regions can occasionally run short, especially during large events. When this happens you may see an allocation failure. Several habits reduce the risk:

  • Allow several VM sizes through Flexible orchestration, so the scale set has more than one way to meet your capacity target.
  • Spread across zones, because a shortage in one zone may not exist in another.
  • Use capacity reservations for critical workloads. A reservation sets aside machines for you in a zone, and you pay for them whether you use them or not, much like booking a hotel room in advance for a big festival.
  • Avoid very rare or very new sizes for core services unless you have confirmed their supply in your regions.
  • Keep a second region ready for the most important systems.

Other limits worth knowing

LimitWhat it means for you
Maximum instances per scale setA single scale set tops out at one thousand instances, so very large fleets use several scale sets side by side
Region boundaryOne scale set lives in one region, so global designs need one scale set per region
Image availabilityA custom image version must be replicated to the region where you want to use it
Network addressesYour subnet must contain enough free addresses for the largest group you expect, plus room for upgrades that surge
Load balancer limitsBackend pool size and rule counts have maximums, so check them for very large designs
Disk and network throughputEach VM size has its own ceiling for disk operations and network speed, which can be the real bottleneck instead of CPU

Plan your address space

A surprising number of scale-out failures happen because the subnet ran out of IP addresses. Each instance needs at least one address, and Azure keeps a few addresses in every subnet for its own use. If you expect two hundred instances and plan rolling upgrades with surge, give the subnet room for far more than two hundred. It is cheap to choose a larger subnet at the start and painful to change it later.

!
Launch-day checklist

A week before a big event, confirm four things: quota is raised, subnet space is large enough, the maximum instance count matches your plan, and the downstream database and cache can handle the extra connections.

Test the edges on purpose

Do not wait for real customers to discover your limits. In a test environment, push the scale set to its planned maximum with a load test. Watch how long scale-out takes, whether any instance fails to start, how the database copes, and how quickly the group shrinks again. A single rehearsal teaches more than a month of reading documentation.

20Frequently Asked Questions

Short, direct answers to the questions beginners ask most.

Q1Does Azure charge extra for a Virtual Machine Scale Set?
No. The scale set is a free management layer. You pay for the virtual machines, disks, load balancers, public IP addresses, data transfer, and monitoring that it creates.
Q2What is the difference between a scale set and an availability set?
An availability set only spreads a fixed group of VMs across fault domains inside a data center. A scale set does that kind of spreading and also creates, removes, updates, and repairs instances automatically, and it can span zones. For most new designs, scale sets with zones are the stronger choice.
Q3Should I use Flexible or Uniform orchestration?
For new projects, start with Flexible, which Microsoft recommends. It gives scale set automation with more control over individual instances and supports mixed sizes and Spot priority mix. Use Uniform only if you have a specific requirement that Flexible does not yet meet, and check the current documentation first.
Q4Can a scale set span multiple regions?
No. A scale set lives in one region, though it can spread across zones inside that region. For multi-region designs, create one scale set per region and use a global service such as Azure Front Door or Traffic Manager in front.
Q5Can I mix different VM sizes in one scale set?
In Flexible orchestration, yes. This helps when one size is temporarily unavailable or when you want a blend of cost and performance. Uniform orchestration uses one size for all instances.
Q6How fast can a scale set add instances?
Creating an instance usually takes minutes, not seconds, and your own application’s startup time is added on top. Heavy images, long install scripts, and slow health checks all lengthen it. Baking software into the image and using scheduled or predictive scaling for known peaks both help.
Q7What happens to my data when an instance is deleted?
Data on an ephemeral OS disk is lost. Data on managed disks may be deleted along with the instance depending on your settings. Treat the instance’s local storage as temporary and keep important data in databases or storage accounts.
Q8Can I scale on something other than CPU?
Yes. Autoscale can use metrics such as memory from guest agents, request counts, queue lengths in Storage or Service Bus, and custom metrics. Choose the number that best reflects how busy the application really is.
Q9Why did my scale set not grow even though CPU was high?
Common reasons are that the maximum count was reached, a cooldown period was still running, the metric window had not yet filled, the subscription quota was exhausted, or the region did not have capacity for that VM size. Check the autoscale activity log and the scale set’s operation history to see the exact reason.
Q10Can I log in to individual instances?
You can, using methods like Azure Bastion or controlled inbound rules, but try not to depend on it. Logging in to fix things by hand creates snowflake servers. Prefer fixing the image or startup configuration and replacing the instance.
Q11Is a scale set the same thing as Kubernetes?
No. A scale set manages virtual machines. Kubernetes manages containers across machines. They work well together, since Azure Kubernetes Service uses scale sets for its worker nodes.
Q12Can I scale a scale set down to zero?
Yes, the capacity can be zero when you do not need any instances, which is handy for batch and build workloads. Remember that your autoscale minimum must also allow zero, and starting from zero means the first new instances take the usual creation time.
Q13How do I roll back a bad release?
Change the scale set model back to the previous image version and roll it out with the same rolling upgrade process. Keeping older image versions in the Azure Compute Gallery makes this quick and predictable.
Q14Do I need a load balancer?
Only if the instances serve incoming traffic. Worker groups that pull jobs from a queue do not need one. If you do serve requests, use a load balancer or an application gateway so traffic is shared across healthy instances.

21Summary and Key Takeaways

You started with a pizza shop that could not decide how many ovens to buy. You now know how Azure solves that problem for computers.

A Virtual Machine Scale Set is a free management layer that builds and runs a group of identical virtual machines from one recipe. It lets that group grow, shrink, spread across failure boundaries, update safely, and heal itself. Around it sit load balancers, images, identities, vaults, and monitoring, and together they make an application that is cheaper than a fixed fleet and tougher than a single machine.

Key Takeaways

  • A scale set is a manager, not a machine. It keeps a group of identical instances in the shape described by its model, and it costs nothing extra beyond the resources it creates.
  • Prefer Flexible orchestration for new designs, and spread instances across availability zones to survive building-level failures.
  • Design instances to be disposable. Keep data and sessions outside them, build immutable images, and let the platform repair or replace anything unhealthy.
  • Autoscale on signals that mirror user pain, leave a wide gap between scale-out and scale-in thresholds, scale out fast and in slowly, and set firm minimum and maximum counts.
  • Roll out changes in small batches with rolling upgrades and real health checks, and always keep the previous image version ready for a quick rollback.
  • Layer your security: private subnets, managed identities, Key Vault, trusted launch, encryption, and patching through new images or an update service.
  • Watch and tune. Ship logs and metrics off the instance, alert on symptoms users feel, review autoscale history after busy events, and mix reserved base capacity with Spot for savings.