Azure Virtual Machines: how to choose VM size, availability, and stop behavior
Azure Virtual Machines (Azure VMs) are managed compute resources for running a complete Windows or Linux operating system when you need to configure the guest environment yourself. Azure operates the physical servers and virtualization layer, but you remain responsible for the operating system, patches, accounts, and applications inside the VM. Before deployment, choose a size and disks for the workload, design zones or scale sets for the availability you need, and understand the billing difference between stopping a VM and deallocating it.
Azure Virtual Machines (Azure VMs) are managed compute resources for running a complete Windows or Linux operating system when you need to configure the guest environment yourself. Azure operates the physical servers and virtualization layer, but you remain responsible for the operating system, patches, accounts, and applications inside the VM. Before deployment, choose a size and disks for the workload, design zones or scale sets for the availability you need, and understand the billing difference between stopping a VM and deallocating it.
What does Azure manage, and what remains your responsibility?
When you create a VM, Azure boots a guest operating system from the image you select. You can install existing software or the runtime your application needs. This is useful when you need OS-level control or want to move a program built for a physical server. You still need to operate OS security updates, user permissions, service configuration, malware protection, backup, and recovery. Creating the VM does not transfer maintenance of its OS or application to Azure.
A basic deployment includes a VM size, image and region, OS disk, network interface, virtual network, and security rules. You can attach data disks separately from the OS disk. That separation helps keep data independent when you redeploy an OS, but a separate disk is not a backup. Design network security rules to allow only necessary management paths and sources rather than exposing SSH or RDP to the entire internet.
How should you choose a VM size and disks?
A VM size combines resources such as vCPUs, memory, supported temporary and persistent storage, and network performance. A CPU-bound task and a workload that keeps a large dataset in memory can need different sizes. Measure the application's CPU, memory, and disk latency, then test representative load on candidate sizes instead of choosing by family name alone. Confirm that the image and size are available in the target region and zone before deployment.
Azure managed disks handle disk creation and management without requiring you to manage the underlying storage account's scalability. Separate the OS disk, data that must persist, and cache that can be rebuilt; choose the required performance tier and capacity. Disk storage is billed separately from VM compute. Compute charges depend on VM size and OS, and disks or some networking resources can continue to cost money when the VM is not running. Estimate the components in your actual configuration.
If you plan to deploy many VMs, check subscription quotas. Even with quota approval, a deployment, start, or resize can fail when the target region or zone lacks physical capacity. Quota and available capacity are separate constraints.
How do zones and scale sets affect availability?
A single VM is one instance and does not provide high availability by itself. Azure Availability Zones are physically separate failure domains within a region. To keep serving requests after a zone failure, place application replicas in at least two zones and also design redundancy for data, networking, and traffic routing. Merely creating two VMs does not guarantee automatic recovery if load balancing, data replication, or capacity in the surviving zone is missing.
For a load-balanced group whose instance count can change with demand, consider Virtual Machine Scale Sets. They help manage the creation, configuration, and updating of multiple VMs as a group. Zone placement and recovery behavior depend on orchestration choices and application architecture, so design for stateful data and recovery as well as placement. At the documentation review date, Azure's VM zone resilience feature was marked preview; do not treat it as a generally available production recovery feature without checking its current status and limitations.
How do Stop and Deallocate differ for billing?
If you shut down a VM but leave it in Stopped (Allocated), Azure still holds host capacity for it and continues to bill VM compute. In Stopped (Deallocated), the VM releases its allocation on the underlying hardware, so VM compute is not billed; attached disks and some networking resources can still incur charges. If a nightly shutdown routine for a development VM is meant to reduce cost, verify that its final state is Deallocated. Do not assume that shutting down from inside the guest OS also deallocates the VM.
Distinguish power state from provisioning state. Power state tells you whether the VM is running, stopped, or deallocated. Provisioning state reports whether a control-plane operation such as creation or update succeeded; it is different information. Check the actual power state in the VM overview or Instance View, and use cost analysis to review compute, disks, public IPs, and other remaining resources separately.
What risks come with resizing or using Spot VMs?
Changing an existing VM's size restarts a running VM. Azure may require deallocation first when the requested size is unavailable on the current host cluster; deallocation can release dynamic IP addresses. Schedule the change for a suitable maintenance window and check fixed IPs, connections, and service recovery. If allocation fails, the configuration may display the requested size while the VM continues running on the previous size, so verify the operation and instance state.
Azure Spot VMs use spare capacity at a discount, but have no capacity priority or availability SLA and can be evicted at any time. They fit interruptible workloads that can be restarted, such as batch processing, rendering, or testing. Before choosing Spot, plan the eviction policy, automated restart or redeployment, persistent data, and fallback sizes or regions. Avoid using Spot as the default VM for a service that cannot tolerate interruption.
Example: running a development VM that shuts down overnight
Illustrative scenario: A team uses a test VM only during weekday business hours. First, confirm the app's OS needs, select a candidate size, and observe CPU and memory under representative load. Next, separate the OS from rebuildable temporary files; keep test data that must persist on a managed data disk and define whether it needs backup. Restrict administrative access to approved addresses or a private management path. After an automated shutdown, verify the VM reaches Stopped (Deallocated). The next workday, confirm that the VM starts and the app, disks, and access path work.
This can reduce VM compute charges, but disks and networking resources may still be billed, and the VM's size may not be immediately available when it starts again. For a service that must restart immediately, consider whether capacity reservations, replicas across zones, or a managed scale configuration better meet the requirement than nightly deallocation.
What to check before creating a VM
Does the application need control of a complete guest OS, or could containers or a managed service reduce operational work?
Are the image, VM size, disk performance, and network configuration available in the target region and zone, and is subscription quota sufficient?
Have you separated the OS disk, persistent data, and rebuildable temporary data? Do you know how to restore from backup?
Can the service tolerate a single VM outage? If not, have you planned zone replicas, traffic distribution, data replication, and recovery procedures?
When stopping, do you distinguish `Stopped` from `Stopped (Deallocated)` and check VM, disk, and network charges separately?
Is someone responsible for OS patching, administrative access, alerts, resizing, and recovery?
Azure VMs give you control over the OS and runtime, along with responsibility for patches, access, storage, availability, and cost. Decide first whether the workload truly needs VM-level control; then specify size, zone, and shutdown behavior. That makes it easier to avoid excess capacity and unexpected downtime.
References
[Microsoft Learn: Overview of Azure virtual machines](https://learn.microsoft.com/en-us/azure/virtual-machines/overview)
[Microsoft Learn: VM power states and billing](https://learn.microsoft.com/en-us/azure/virtual-machines/states-billing)
[Microsoft Learn: Availability options for Azure VMs](https://learn.microsoft.com/en-us/azure/virtual-machines/availability)
[Microsoft Learn: Resize a virtual machine](https://learn.microsoft.com/en-us/azure/virtual-machines/sizes/resize-vm)
[Microsoft Learn: Spot VM eviction policy and recovery design](https://learn.microsoft.com/en-us/azure/architecture/guide/spot/spot-eviction)
[Microsoft Learn: Azure Spot Virtual Machines](https://learn.microsoft.com/en-us/azure/virtual-machines/spot-vms)
[Microsoft Learn: Troubleshoot VM allocation failures](https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/windows/allocation-failure)
Documentation checked on 2026-11-20. Prices, region-specific SKU capacity, preview status, and subscription quotas can change; verify them in the target environment before deployment.