Compare model intent and instance state
When Contoso's first VM runs v2-bad and the other three still serve v1, which release would a fifth VM get? The scale-set model answers what Azure would install. The instance inventory and a quote request on each VM reveal what's actually running. You'll use both to establish a baseline before deciding what to change.
The scale-set model describes what Azure should create or apply. It doesn't tell you what an existing process is serving. A VM can be running an earlier image or extension configuration, or someone might have changed a file in the guest without changing the model. Before choosing a recovery action, compare the model and release record with evidence from each VM:
| What to compare | Evidence from the model or release record | Evidence from each instance |
|---|---|---|
| Image | Publisher, offer, SKU, and approved exact version | Actual image reference and resolved version |
| Application | Installer, release parameter, and extension update tag | Release and result returned by /work |
| Configuration | Desired extension settings and upgrade policy | Latest model applied, resolved extension handlers, and guest configuration |
| Health | Configured health source, endpoint, and thresholds | Current health, recent transitions, and request results |
| Protection | Fleet policy and operating procedure | Per-instance scale-in and scale-set-action protection flags |
Contoso uses Uniform orchestration: its worker VMs are child resources of the scale set, and the operator targets an individual instance by its scale-set instance ID. In Flexible orchestration, each VM is a standard Azure resource and can have its own configuration. Use standard VM and extension APIs with the VM's resource identity when inspecting or deliberately changing that individual configuration.
Synchronizing a VM with the scale-set profile is a separate operation. With az vmss update-instances, --instance-ids takes Uniform instance IDs but Flexible VM names. For a Flexible VM, confirm that your Azure CLI and Compute API versions support the operation. Review the entire profile before applying it because the VM might have intentional differences from that profile. You choose the orchestration mode at creation and can't change it later.
Don't confuse an application rollout with an automatic operating system (OS) image upgrade. An OS image upgrade replaces the OS disk with one built from a supported newer image under its own eligibility and health rules. Automatic OS image upgrades and automatic extension upgrades use rolling-policy settings independently of the model's upgrade mode. Switching the model to Manual doesn't stop them. Contoso leaves both disabled during this change. In Flexible orchestration, automatic OS image upgrades are a preview feature and can't be combined with MaxSurge, which creates extra VMs during an upgrade.
Establish a healthy baseline for the VMs and the quote service
Contoso's baseline is four regular-priority Standard_D2s_v5 VMs with managed OS disks in East US 2. The release record pins an exact Canonical ubuntu-24_04-lts:server image version, not latest. The Linux Custom Script extension (2.1) installs the Quote Worker application; the Application Health Linux extension (1.0) starts after the installer. The installer's settings and command select the application release. Contoso also sets forceUpdateTag to the release identifier so changing the tag makes the extension run the installer again. The tag's text doesn't tell Azure how to downgrade the application.
This worked recovery assumes that Contoso's approved installer supports both a clean v1 installation and restoring v1 on a VM that has run v2-bad. The release team has checked that it replaces the affected application files and configuration, restarts the quote service correctly, and can be run again without harmful side effects. This incident doesn't include a backward-incompatible change to queued requests or the order system. These are prerequisites for the recovery shown here, not capabilities supplied by the Custom Script extension.
Selecting a minor handler version at deployment isn't the same as enabling platform automatic extension upgrades. Before rollout, record the extension handler versions installed on each VM. During recovery, compare them with that record so you can distinguish a handler change from a change to the quote application.
Before a rollout, the operator opens Virtual machine scale sets > selected scale set > Instances and confirms that all four instances are running, using the approved image, and reporting stable health. Under Health and repair, confirm that the Application Health extension is the health source and automatic repairs are off. Under Upgrade policy, confirm that model updates are set to Manual. Under Scaling, confirm that capacity is fixed at four VMs and autoscale is off.
These read-only Azure CLI commands, shown in PowerShell, capture three different views. Set $Rg and $Name to the resource group and scale set of interest, and confirm the subscription before interpreting the output.
az account show --query '{subscription:name,id:id}' --output table
az vmss show --resource-group $Rg --name $Name --output json
az vmss list-instances --resource-group $Rg --name $Name --expand instanceView --output json
az vmss get-instance-view --resource-group $Rg --name $Name --output json
az vmss show displays the desired model. az vmss list-instances shows each VM's ID, status, and whether it has applied the latest model. az vmss get-instance-view reports the state of scale-set services, including automatic repairs. Save dated copies before a change, at containment, and after recovery. Keep the approved template, installer, image version, and deployment parameters in the release store: a model read omits protected extension settings and can't reconstruct an undocumented guest edit.
Check access, allocation, and cost before a change
Contoso's operating ceiling is five VMs. It doesn't guarantee that Azure can allocate a fifth VM. Check the constraints that could prolong an interruption affecting a single VM.
| Constraint | What the operator checks |
|---|---|
| Quota and addresses | Four Standard_D2s_v5 VMs use eight vCPUs; the fifth needs two more in both the regional and Dsv5-family quotas. Account for other workloads. A /27 subnet has 27 usable addresses after Azure reservations; subtract those already assigned. Check regional or zonal size and image availability. Free quota doesn't guarantee allocation. |
| Management access | Use an independent private administrator host or Azure Bastion. Run Command needs a working guest agent; boot diagnostics can still help if the agent fails. Don't disable the only management route. Contoso uses a private subnet, a network security group, and a NAT gateway with a Standard public IP for outbound access. The VMs have no public IP addresses or inbound application rules. |
| Permissions | Use read access for inspection and only the write permissions needed for the approved change. A resource-group-scoped Contributor can manage Compute, Network, deployments, and Monitor settings in a dedicated group, not assign roles. Quota inspection needs subscription visibility. Don't widen permissions to work around an unexplained error. |
| Budget and time | Five VMs for six hours is at most 30 instance-hours at that ceiling. Price disks, NAT gateway time and data, its public IP, and management services separately. A budget alert isn't a hard spending stop. Allow for allocation delays: 15-30 minutes for deployment and 10-30 minutes per rollout or repair are planning estimates, not deadlines Azure guarantees. Stop and seek approval rather than repeatedly extending the window. |