Virtual Machines in Azure: Your Own Computer, Rented by the Hour

Virtual Machines in Azure: Your Own Computer, Rented by the Hour

A beginner-friendly guide to Azure Virtual Machines, covering sizes, disks, networking, availability, security, backup, monitoring and cost, explained step by step with everyday analogies.

Imagine you need an office for a new project. You could buy land, construct a building, install lifts and wiring, and hire cleaners. Or you could rent a fully equipped room in a business centre: you pick the size, move in your own furniture and computers, and pay only for the months you use it. The building owner looks after the walls, power, lifts and security guards, and you decide what happens inside your room. An Azure Virtual Machine is exactly this kind of rented room, except that the room is a computer.

In this guide we start with the simple question “what is a virtual machine?”, and slowly build up to sizes, disks, networking, availability, security, backups, monitoring and cost. No earlier knowledge is assumed. Every new word is explained when it first appears, usually with a comparison from daily life. Product details and prices change often, so treat this guide as a map of ideas and confirm specifics in the current Azure documentation.

1What Is an Azure Virtual Machine?

A virtual machine is a software-made computer that runs inside Microsoft’s data centres and behaves like a real one.

A physical computer has a processor, memory, a disk and a network connection. A virtual machine, often shortened to VM, has the same four things, but they are provided by software on a much larger physical server. A special program called a hypervisor divides one powerful server into many separate virtual computers. Each virtual computer believes it owns its own hardware, and each can run its own operating system, such as Windows or Linux.

In Azure, you create a virtual machine in a few minutes by choosing a size, an operating system, a disk and a network. Once it starts, you connect to it over the network, install your software and use it exactly as you would a computer in your own office. When you no longer need it, you delete it and the charges stop.

Azure Virtual Machines belong to a category called Infrastructure as a Service, or IaaS. This means that Microsoft provides the building blocks, such as hardware, power, cooling and the network, while you manage everything from the operating system upwards. That gives you great control and flexibility, and also means that patching, security settings and backups of the inside of the machine are your responsibility.

Simple Analogy

Think of a big apartment building. The owner is responsible for the foundation, the roof, the lifts and the main gate. Each tenant gets a flat, and decides the furniture, the locks on the inside doors and who may visit. A virtual machine is your flat, and Azure is the building owner.

Words you will meet again and again

Term 1

Hypervisor

The software layer that splits one physical server into many isolated virtual machines.

Term 2

vCPU

A virtual processor core given to a VM. More vCPUs mean more computing power.

Term 3

Managed Disk

A virtual hard drive whose storage details are handled for you by Azure.

Term 4

Image

A ready-made template of an operating system, possibly with software, used to start new VMs.

Term 5

Availability Zone

A separate data centre building within a region, with its own power, cooling and network.

Term 6

Scale Set

A group of identical VMs managed together, which can grow and shrink automatically.

IaaS
you manage the OS and everything above it
Minutes
from decision to running machine
Pay per use
billed while compute is allocated

2Why Use Virtual Machines?

Because sometimes you need full control of a computer, without owning one.

Before the cloud, a company that needed a new server placed an order, waited weeks for delivery, paid a large sum in advance and found space in a data centre. If the server turned out to be too large or too small, there was little to do. If the project ended, the server sat idle. Virtual machines in Azure remove these problems. You get a computer in minutes, you pay by the hour, and you can resize or delete it as needs change.

Virtual machines are also the easiest way to move existing applications to the cloud. Many older programs expect a full operating system, specific software versions and settings that a platform service cannot offer. A virtual machine lets you move such an application with few changes. This approach is called lift and shift.

Full control

You choose the operating system, install any software, configure every setting and use special drivers or agents.

Compatibility with existing software

Applications built for a traditional server often run on a VM with minimal changes.

Speed and flexibility

New machines are ready in minutes, can be copied from images and can be deleted when the work is done.

Special hardware

VMs offer options such as graphics processors, very large memory and fast local storage for demanding workloads.

Development and testing

Teams create temporary machines for testing and delete them afterwards, paying only for the hours used.

i
Good to Know

Virtual machines are powerful, but they are not always the best choice. If you do not need control of the operating system, a platform service often means less work and less risk. We compare the options later in this guide.

3Anatomy of a Virtual Machine

A VM is not one object. It is a small family of connected resources.

When you create a virtual machine in the Azure portal, Azure actually creates several resources and links them together. Understanding each part helps you manage, secure and price a machine correctly.

Part 1

The VM Itself

The compute resource: the chosen size, the operating system and the settings that describe the machine.

Part 2

OS Disk

A managed disk holding the operating system. Every VM has one.

Part 3

Data Disks

Optional extra managed disks for application data, databases and files.

Part 4

Network Interface

The virtual network card that connects the VM to a subnet and gives it a private address.

Part 5

Virtual Network and Subnet

The private network where the VM lives and talks to other resources.

Part 6

Network Security Group

A list of allow and deny rules that controls traffic to and from the VM.

Part 7

Public IP Address

An optional internet-facing address. Many VMs are better off without one.

Part 8

Resource Group

A folder-like container that groups related resources so they can be managed and deleted together.

flowchart TD
  RG["Resource Group"] --> VM["Virtual Machine: size and OS"]
  VM --> OSD["OS Disk"]
  VM --> DD["Data Disks"]
  VM --> NIC["Network Interface"]
  NIC --> SN["Subnet in a Virtual Network"]
  NIC --> NSG["Network Security Group"]
  NIC --> PIP["Optional Public IP"]
        
FIG 1 — The resources that make up one virtual machine
Simple Analogy

A flat is more than four walls. It has a front door lock, a nameplate, a postal address, a water connection and storage cupboards. A VM is similar: the machine itself, its disks, its network plug, its security rules and its address together make a usable home.

!
Common Mistake

Deleting only the virtual machine and thinking everything is gone. Disks, network cards and public addresses are separate resources and may remain, still costing money. Put each VM and its related resources in one resource group and delete the group to clean up completely.

4Choosing a Size: Families and Naming

Azure offers hundreds of sizes, grouped into families built for different jobs.

The size of a VM decides how many virtual processors and how much memory it has, how fast its disks and network can be, and how much it costs per hour. Sizes are grouped into families. Choosing the right family is more important than choosing the biggest size.

Family typeStrengthTypical useExample series
General purposeBalanced processor and memoryWeb servers, small databases, development and testingB, D
Compute optimisedHigh processor-to-memory ratioBatch processing, gaming servers, application serversF
Memory optimisedLarge memory per processorDatabases, in-memory caches, big analyticsE, M
Storage optimisedFast local disks and high throughputBig data, data warehouses, search enginesL
GPUGraphics processorsMachine learning, rendering, simulationN
High performance computeVery fast processors and networksScientific modelling, engineering simulationH
ConfidentialHardware-protected memory while runningHighly sensitive data processingDC, EC

Reading a size name

A size name looks like a code, for example a letter followed by a number and some extra letters and a version. The first letter shows the family. The number shows how many virtual processors. Extra letters add features, such as support for premium storage, a different processor brand or local temporary storage. A trailing version number shows the hardware generation. Newer generations usually give better performance for the price.

Simple Analogy

Choosing a vehicle follows similar logic. A hatchback is good for the city, a pickup truck carries loads, a bus carries many people and a sports car is built for speed. You do not buy a bus to commute alone. Pick the family that fits the job, then the size that fits the load.

Burstable VMs

The B-series is special. Its machines run at a modest baseline level of processor use and earn credits while they are idle. When a burst of work arrives, they spend those credits to run faster for a while. They are inexpensive and well suited to light, spiky workloads such as small websites, development machines and low-traffic services. They are a poor fit for steady heavy loads, because after the credits run out, performance drops back to the baseline.

1

Describe the workload

Write down what the machine will do: web serving, database, batch jobs, rendering or something else.

2

Pick the family

Match the main need, such as balanced, memory-heavy or compute-heavy, to a family.

3

Start small and measure

Begin with a modest size, watch real processor, memory and disk use, and adjust.

4

Check limits

Every size caps disk speed, number of disks and network bandwidth. Make sure these limits meet your needs.

5

Review regularly

Revisit the size every few months, since needs change and newer generations appear.

!
Common Mistake

Choosing a large size “to be safe” and never checking. Oversized machines are one of the most common sources of cloud waste. Measure, right-size and keep headroom for peaks, instead of guessing high.

5Images and Operating Systems

Every VM starts from an image, which is like a photocopy of a prepared computer.

An image contains an operating system and sometimes pre-installed software. When you create a VM, Azure copies the image onto the new OS disk. You can choose from many sources.

Source 1

Marketplace Images

Ready-made images from Microsoft and publishers, including many versions of Windows Server, Linux distributions and software appliances.

Source 2

Custom Images

Images you create from your own prepared machine, with your software, settings and security tools already installed.

Source 3

Azure Compute Gallery

A place to store, version and share your images across regions and teams, with controlled replication.

Source 4

Image Builder Pipelines

Automated processes that build and update images regularly, so that they always include current patches.

Generation 1 and Generation 2

VMs come in two generations that describe the virtual hardware platform. Generation 2 uses a more modern design with support for larger disks, faster start-up and security features such as secure boot and trusted launch. New deployments should normally choose Generation 2 unless an old operating system demands the earlier type.

Customising at start-up

VM extensions

Small add-ons that install software or configure the machine after it starts, such as monitoring agents, antivirus or configuration scripts.

Initialisation scripts

On Linux, a standard tool can run set-up instructions at first boot. On Windows, scripts can run through extensions. These steps turn a plain image into a ready application server.

Golden image pattern

Instead of installing everything on every new machine, you prepare one well-tested image and create all machines from it. This makes new machines faster to deploy and identical to each other.

Simple Analogy

A bakery that makes the same loaf every day uses a tested master recipe, not a fresh idea each morning. A golden image is the master recipe for your servers, so that every new machine comes out identical and correct.

i
Keep Images Fresh

An image that was built a year ago contains a year of missing security patches. Rebuild images on a regular schedule and retire old versions, so that new VMs do not start life already out of date.

6Disks and Storage

The speed and safety of a VM depend a great deal on its disks.

Azure VMs use managed disks. A managed disk is a virtual hard drive stored in highly durable Azure storage, with Azure handling the hard details of placement and copies. You choose the type and the size, and Azure takes care of the rest.

Disk typeBacked byBest forRelative cost
Standard HDDMagnetic drivesBackups, rarely used data, dev and test with low performance needsLowest
Standard SSDSolid-state drivesWeb servers, light applications, steady but modest workloadsLow to medium
Premium SSDHigh-performance solid-state drivesProduction databases and applications needing consistent speedMedium to high
Premium SSD v2High-performance drives with adjustable size, speed and operationsWorkloads that need to tune performance separately from sizePay for what you set
Ultra DiskHighest-performance drives with very low delayThe most demanding transactional workloadsHighest

Three kinds of storage on a VM

Storage 1

OS Disk

Holds the operating system. It persists when the VM is stopped.

Storage 2

Data Disks

Hold your data. They persist independently of the VM and can be detached and attached to another VM.

Storage 3

Temporary Disk

Fast local storage on the host, available on many sizes. Its contents can be lost when the VM moves or is redeployed, so never store important data there.

Disk performance limits

Each disk has limits on operations per second and throughput, and each VM size also has its own overall limits. The slower of the two decides what you get, so match the disk type and the VM size.

Striping

Several disks can be combined inside the operating system to increase combined performance and capacity for demanding workloads.

Snapshots and copies

A snapshot is a read-only point-in-time copy of a disk. It is useful for quick restore points and for copying disks to other places, although it is not a full backup strategy.

Encryption

Managed disks are encrypted at rest by default with platform-managed keys. You can use your own keys, or add encryption at the host or inside the operating system for stricter needs.

Simple Analogy

The OS disk is the flat’s main wardrobe with your daily clothes. Data disks are separate storage lockers that you can carry to another flat. The temporary disk is a table in the corridor where you keep things for a moment. Anything left on the corridor table may be moved away, so never keep valuables there.

!
Common Mistake

Putting a database or important files on the temporary disk because it is fast and free. When the VM is redeployed or moved by the platform, the content can disappear. Use managed data disks for anything you need to keep.

7Networking for Virtual Machines

A VM is only useful if the right people and systems can reach it, and nobody else can.

Every VM connects to a virtual network through a network interface. The interface lives in a subnet, which is a slice of the network, and receives a private IP address from that subnet. Other resources in the same network, or in connected networks, can reach the VM using this private address.

1

Place the VM in a subnet

Choose a subnet that matches the machine’s role, such as a web subnet or a database subnet.

2

Get a private address

The VM receives an address inside the subnet. For servers that others depend on, make it static so it does not change.

3

Apply security rules

A network security group on the subnet or interface decides which traffic is allowed in and out.

4

Decide on public exposure

Give a public IP only if the machine must be reached from the internet. Prefer a load balancer or gateway as the public front door.

5

Plan outbound access

Decide how the VM reaches the internet for updates, such as through a NAT gateway or firewall, instead of relying on defaults.

Feature

Accelerated Networking

Lets network traffic bypass part of the host software for lower delay and higher throughput. Supported on many sizes and recommended where available.

Feature

Multiple Network Interfaces

Some sizes support several network interfaces, useful for separating management traffic from application traffic.

Feature

Proximity Placement

Places machines physically close together to reduce delay between them, for chatty applications.

Feature

Load Balancing

Spreads traffic over several VMs and removes unhealthy ones from rotation using health checks.

Simple Analogy

A flat has a private internal number for the intercom, and the society has one main gate address for visitors. Most flats are never given their own street entrance. Likewise, most VMs should have private addresses only, and be reached through one controlled public front door.

!
Common Mistake

Giving every VM a public IP and opening remote desktop or secure shell ports to the internet. Attackers find such machines within minutes. Use a secure access service or a private connection for administration instead.

8Inside the Machine: How a VM Really Runs

Peeking behind the curtain explains many behaviours that otherwise seem strange.

Azure data centres contain huge numbers of physical servers, called hosts. A control system inside Azure decides which host should run your new VM, based on the size you chose, the region and zone, the available capacity and rules such as keeping machines apart for resilience. The chosen host runs a hypervisor, based on Microsoft’s Hyper-V technology, which carves out the virtual processors and memory for your VM and keeps it isolated from the other VMs on the same host.

1

You send a request

The portal, a command line tool or an automation template asks the Azure management layer to create a VM.

2

Policies and quotas are checked

Azure checks your permissions, your subscription’s quota for that size and region and any policy rules.

3

A host is chosen

The allocation system picks a physical server that has room and meets your placement choices.

4

Resources are attached

The OS disk is created from the image, the network interface is connected and the virtual hardware is set up.

5

The VM boots

The hypervisor starts the VM, the operating system loads, and the Azure agent inside the VM reports that it is ready.

6

Extensions and settings apply

Agents and scripts configure the machine, and it becomes available to you.

sequenceDiagram
  participant U as You
  participant M as Azure Management Layer
  participant A as Allocation System
  participant H as Physical Host with Hypervisor
  participant V as Your VM
  U->>M: Create VM request
  M->>M: Check permissions, quota and policy
  M->>A: Find a host
  A->>H: Reserve capacity
  H->>V: Create virtual hardware, attach disks and network
  V-->>M: Agent reports ready
  M-->>U: VM is running
        
FIG 2 — What happens when you create a virtual machine

Why this matters to you

Isolation

The hypervisor separates your VM from other customers’ VMs on the same host. Strong isolation is a foundation of cloud security.

Capacity and quotas

Each subscription has limits on the number of cores per region and per family. If a deployment fails with a capacity or quota message, the allocation step could not find or permit resources.

Host maintenance

Hosts need updates and repairs. Azure uses techniques such as live migration and memory-preserving updates to move or pause VMs with little or no visible effect, and sometimes a restart is needed.

Noisy neighbour control

Resources are allocated by size so that one VM cannot starve others. Burstable sizes are the exception, since they follow a credit model.

Simple Analogy

A hotel front desk checks your booking, finds a room with the right bed type, prepares it, gives you a key and tells housekeeping to supply towels. You never see these steps, but they explain why the room is ready in minutes and why sometimes a room of your type is not available.

9The VM Lifecycle and What You Pay For

A VM can be in several states, and the billing depends on the state.

StateWhat it meansCompute billed?Disks billed?
CreatingAzure is building the VMStarts when allocatedYes
RunningThe VM is on and servingYesYes
Stopped but allocatedThe operating system is shut down, but Azure still holds the compute for youYesYes
Stopped and deallocatedThe VM is off and the compute is releasedNoYes
DeletedThe VM resource is removedNoOnly for disks and other resources that remain
flowchart LR
  C["Creating"] --> R["Running"]
  R -->|"shut down inside OS"| S["Stopped but allocated: still billed"]
  R -->|"stop from Azure"| D["Stopped and deallocated: compute not billed"]
  D -->|"start"| R
  S -->|"start"| R
  D -->|"delete"| X["Deleted"]
        
FIG 3 — VM states and which ones are billed for compute
Simple Analogy

Switching off the lights in a rented office does not stop the rent, because you still hold the room. Handing back the keys stops the rent, but you give up the guarantee that the same room will be free when you return. Deallocation is handing back the keys.

Other useful operations

Action

Resize

Change the size of a VM. It usually restarts, and some changes need deallocation if the new size lives on different hardware.

Action

Redeploy

Move the VM to a new host, which can fix certain connectivity problems. Temporary disk content is lost.

Action

Restart

Reboot the VM on the same host, without releasing compute.

Action

Capture an Image

Create a reusable image from a prepared VM, after generalising it where needed.

!
Common Mistake

Believing that shutting down Windows or Linux from inside the machine stops the bill. Use the stop action in Azure so that the VM is deallocated. Also remember that deallocated VMs lose their dynamic public addresses and may land on a different host when restarted.

10Availability: Surviving Failures and Maintenance

Hardware fails and hosts need updates, so serious workloads need more than one VM and a smart layout.

A single VM on a single host can be affected by hardware problems or by planned maintenance. Azure offers ways of spreading VMs so that one event does not take down the whole application.

Option 1

Single VM

One machine, no redundancy. Fine for development, but a poor choice for important production services. Azure offers a limited availability promise for single VMs with premium disks.

Option 2

Availability Set

Spreads VMs across fault domains, which are separate racks with their own power, and update domains, which are groups that are updated at different times. Protects against rack and maintenance events inside one data centre.

Option 3

Availability Zones

Spreads VMs across separate data centre buildings in a region. Protects against the loss of an entire building and gives a stronger availability promise.

Option 4

Multiple Regions

Runs copies in different regions for protection against a regional disaster, using traffic routing and data replication.

flowchart TD
  LB["Load Balancer"] --> Z1["VM in Zone 1"]
  LB --> Z2["VM in Zone 2"]
  LB --> Z3["VM in Zone 3"]
  Z1 --> D["Zone-redundant Database or Storage"]
  Z2 --> D
  Z3 --> D
        
FIG 4 — VMs spread across zones behind a load balancer
LayoutProtects againstTypical use
Single VMLittle beyond basic platform resilienceDevelopment, test, non-critical tools
Availability set with two or more VMsRack failures and planned maintenance in one data centreProduction in regions without zones, or legacy designs
Zones with two or more VMsFailure of an entire data centre buildingMost production workloads
Multi-regionRegional disastersMission-critical systems
Simple Analogy

A bank that keeps all counters in one room can be shut down by a water leak in that room. Counters in separate rooms keep serving customers. Counters in separate buildings survive a fire in one building. Zones are separate buildings for your servers.

i
Promises Come with Conditions

The availability percentages in Azure’s service agreements assume that you follow its conditions, such as deploying two or more instances across zones or sets. A single machine cannot receive the strongest promise. Read the current agreement for exact figures.

!
Common Mistake

Spreading web servers across zones but keeping the only database server in one zone. The application still fails if that zone fails. Make every layer resilient, or the weakest layer decides your availability.

11Scale Sets and Load Balancing

When one machine is not enough, a group of identical machines can share the work.

A Virtual Machine Scale Set is a group of identical VMs created from the same image and configuration, managed as one unit. You can define rules that add machines when load rises and remove them when it falls. This is called autoscaling. A load balancer in front spreads the traffic over whichever machines are running.

1

Prepare a standard image

Build an image or a start-up configuration that makes each new VM ready to serve without manual steps.

2

Create the scale set

Define the number of instances, zones, network placement and the load balancer connection.

3

Set autoscale rules

Choose metrics such as processor use or queue length, thresholds and minimum and maximum instance counts.

4

Add health checks

Let the platform detect unhealthy instances and replace them automatically.

5

Roll out updates gradually

Update instances in batches, so that part of the capacity always remains available.

Uniform and flexible orchestration

Scale sets can manage identical instances, or allow mixing different sizes and types of VMs inside one group, depending on the mode you choose. Check current options when designing.

Stateless design

Scale sets work best when instances keep no unique data. Store sessions and files in shared services such as caches, databases or storage, so that any instance can be replaced at any time.

Combining spot and regular capacity

Scale sets can include discounted interruptible instances for flexible workloads along with regular ones for the stable base.

Simple Analogy

A supermarket opens extra checkout counters when the queue grows and closes them when it shrinks. All counters are identical, and customers go to whichever is free. A scale set and a load balancer behave the same way.

!
Common Mistake

Keeping important data on individual scale set instances. When autoscale removes an instance, its data disappears. Keep state outside the instances, in databases or storage.

12Maintenance, Patching and Updates

Because you own the operating system, you also own its updates.

Azure maintains the physical hosts and the hypervisor. You maintain the operating system and the applications inside your VM. Unpatched operating systems are among the most common ways attackers break into servers, so a clear patching routine is essential.

Tool

Azure Update Manager

A service to assess missing updates, schedule installation and report compliance across many Windows and Linux machines, in Azure and elsewhere.

Tool

Automatic Guest Patching

An option that applies certain updates automatically in safe batches, while respecting availability settings.

Tool

Maintenance Configurations

Lets you control when some platform maintenance is applied to your machines, within allowed limits.

Tool

Image Refresh

For scale sets and golden image designs, build new images and replace instances instead of patching each one.

1

Assess

Find out which machines are missing updates and how serious they are.

2

Test

Apply updates first to a test group, and check that applications still work.

3

Schedule

Pick maintenance windows that suit the business, with machines in different zones updated at different times.

4

Deploy and verify

Install updates, check health, and report results. Roll back or fix if something fails.

Simple Analogy

A building owner repairs the roof and lifts, but each tenant must service their own air conditioner and replace their own locks. Neglecting your own part, because the owner looks after the building, is a recipe for trouble.

!
Common Mistake

Treating patching as someone else’s job because “it is the cloud”. The operating system in a VM is the customer’s responsibility. Assign an owner, automate updates and measure compliance, or vulnerabilities accumulate.

13Security for Virtual Machines

Security for a VM works best in layers, from the network down to the data on its disks.

1

Network layer

Place the VM in a private subnet, use network security groups with least-privilege rules and avoid public addresses where possible.

2

Administrative access

Use Azure Bastion for browser-based remote sessions, or just-in-time access that opens management ports only briefly for approved users.

3

Identity layer

Sign in with Microsoft Entra ID where supported, use multi-factor authentication, role-based access control and avoid shared local administrator passwords.

4

Machine hardening

Patch regularly, remove unnecessary software, enable the host firewall, install endpoint protection and use secure boot and trusted launch on supported VMs.

5

Data layer

Encrypt disks, use your own keys if rules require it and protect secrets in Azure Key Vault instead of files on the machine.

6

Detection and response

Turn on monitoring, use Microsoft Defender for Servers where appropriate and alert on suspicious activity.

Feature

Managed Identities

Let applications on the VM authenticate to Azure services without storing passwords or keys on the machine.

Feature

Trusted Launch

Adds secure boot and virtual trusted platform module protection against boot-level attacks on supported Generation 2 VMs.

Feature

Confidential VMs

Protect data in use through hardware-based encryption of memory, for the most sensitive workloads.

Feature

Encryption at Host

Encrypts data on the host, including temporary disks and caches, before it reaches storage.

Simple Analogy

A secure flat has a guarded society gate, a visitor register, a strong door lock, a safe inside and a camera. Remove any one of them, and the flat is weaker. The layers of VM security work together in the same way.

!
Common Mistake

Leaving passwords, connection strings and keys inside scripts or configuration files on the VM. Anyone who gains access to the machine can read them. Use managed identities and Key Vault so that secrets never sit on disk.

14Backup and Disaster Recovery

Redundancy keeps you running through hardware problems, but only backups protect you from mistakes and attacks.

If a user deletes important files or ransomware encrypts a disk, every zone and every copy will faithfully reflect the damage. To recover, you need separate backups and, for larger disasters, a recovery plan.

Service

Azure Backup

Takes scheduled, application-consistent backups of whole VMs, stores them in a vault and lets you restore a VM, a disk or individual files.

Service

Azure Site Recovery

Replicates VMs to another region or zone, so that you can fail over during a disaster and fail back later.

Feature

Snapshots

Quick point-in-time copies of disks, handy before risky changes, but not a replacement for managed backups.

Feature

Soft Delete and Immutable Vaults

Protect backups themselves from accidental or malicious deletion, so attackers cannot remove your safety net.

QuestionBackupDisaster recovery
Protects againstDeletion, corruption, ransomware, mistakesLoss of a data centre or a whole region
Recovery speedRestore time depends on size, often minutes to hoursFailover aims for minutes
Data loss windowTime since the last backupReplication delay, often very small
CostLowerHigher, since you pay for replicas and standby resources
1

Define recovery goals

Decide how much data loss and downtime each application can accept. These are called recovery point and recovery time objectives.

2

Choose the protection

Use backup for everything that matters and disaster recovery replication for the most critical systems.

3

Protect the backups

Use separate vaults, restricted access and soft delete or immutability.

4

Test restores and failovers

Rehearse recovery regularly and record the actual time it takes.

Simple Analogy

A photocopy of your important documents kept in a different cupboard protects you if you lose the original. A second copy stored in another city protects you from a fire or flood that destroys the whole house. Backup and disaster recovery are those two kinds of copies.

!
Common Mistake

Having backups that were never restored. A backup that fails when needed is no backup at all. Schedule restore tests and keep notes on the steps and timing.

15Monitoring and Diagnostics

You cannot manage a machine you cannot see.

Azure provides basic metrics for VMs automatically, measured from outside the machine. These include processor use, disk operations, network traffic and availability. To see what happens inside the operating system, such as memory use, event logs and running processes, you install the Azure Monitor Agent and tell it what to collect.

Tool

Platform Metrics

Collected automatically. Good for quick health charts and simple alerts.

Tool

Azure Monitor Agent and Data Collection Rules

Collect guest-level performance counters and logs, and send them to a Log Analytics workspace.

Tool

VM Insights

A ready-made view of performance trends and the connections between machines and processes.

Tool

Boot Diagnostics

Shows the console output and a screenshot of a VM that will not start or cannot be reached. A lifesaver for troubleshooting.

Metrics worth alerting on

Sustained high processor use, low available memory, disk space running out, disk latency, and the VM becoming unavailable.

Logs worth keeping

Operating system security events, sign-in records, system errors and application logs, kept for the period that your rules require.

Resource Health and Service Health

Tell you whether a problem is with your VM or with the Azure platform, which saves time when something goes wrong.

Simple Analogy

A building manager can see from outside whether the lights are on, but to know whether the flat’s air conditioner is working properly, someone must look inside. The platform metrics are the view from outside, and the agent is the person looking inside.

i
Enable Boot Diagnostics Early

Turn on boot diagnostics when you create a VM. When a machine stops responding, the screenshot and console log often reveal the problem in seconds, but they cannot be created after the failure has happened.

16Pricing Models and Cost Control

The same VM can cost very different amounts depending on how you buy it and how you manage it.

OptionHow it worksBest for
Pay-as-you-goPay the standard hourly rate for the time compute is allocatedShort-term, unpredictable and experimental use
ReservationsCommit to a VM size family in a region for one or three years for a lower rateSteady, always-on workloads
Savings plans for computeCommit to a fixed hourly spend across eligible compute for a lower rateSteady usage that may change size or region
Spot VMsUse spare capacity at a deep discount, with possible eviction when Azure needs capacity backInterruptible batch jobs and flexible workloads
Azure Hybrid BenefitUse eligible existing Windows Server or SQL Server licences, or certain Linux subscriptions, to lower costsOrganisations with eligible licences
Dev/Test pricingReduced rates for non-production environments under eligible subscriptionsDevelopment and testing
1

Right-size

Measure real use and move to a size that fits, with a margin for peaks.

2

Switch off what you do not use

Auto-shutdown and schedule non-production machines, and make sure they are deallocated.

3

Clean up leftovers

Remove unattached disks, unused public addresses and old snapshots.

4

Commit for the steady base

After usage settles, use reservations or savings plans for always-on machines.

5

Use cheaper options where safe

Consider spot capacity for fault-tolerant work, burstable sizes for light loads and standard disks for non-critical data.

6

Track and tag

Tag machines by owner and environment and review cost reports monthly, with budgets and alerts.

Simple Analogy

Renting a car daily is flexible but expensive. A monthly lease is cheaper if you drive daily. A shared car you can lose if the owner needs it is the cheapest, but not for an important journey. VM pricing options follow the same trade-off between flexibility and price.

!
Common Mistake

Buying long reservations for machines that are oversized or about to be replaced. The discount locks in waste. Clean up and right-size first, then commit only to the steady base.

17Virtual Machines Compared with the Alternatives

A VM is one of several compute options, and the best choice depends on how much control you need.

OptionYou manageMicrosoft managesBest for
Virtual MachinesOperating system, runtime, application, patching, scaling designHardware, hypervisor, data centreFull control, legacy applications, special software and drivers
Scale SetsImage, application, rulesInstance creation, scaling mechanics, hardwareStateless, scalable fleets of identical servers
App ServiceApplication code and settingsOperating system, runtime patching, scaling platformWeb apps and APIs without server management
Containers and KubernetesContainer images, cluster design, some node settingsControl plane and underlying hardwareMicroservices and portable applications
Azure FunctionsFunction codeAlmost everything elseEvent-driven code that runs briefly
Azure VMware Solution and Dedicated HostGuest systems or hypervisor settingsDedicated hardware and facilityMoving VMware estates, or licence and compliance needs for dedicated hardware
flowchart TD
  Q["Do you need control of the operating system?"] -->|"Yes"| VM["Virtual Machines or Scale Sets"]
  Q -->|"No"| Q2{"Is it a web app or API?"}
  Q2 -->|"Yes"| AS["App Service"]
  Q2 -->|"Event-driven short tasks"| FN["Azure Functions"]
  Q2 -->|"Containerised microservices"| K["Containers or Kubernetes"]
        
FIG 5 — A simple way to choose a compute option
Simple Analogy

A VM is renting an empty kitchen where you bring everything. App Service is a meal-kit where the prep is done. Functions is ordering a dish only when you are hungry. Containers are standard lunch boxes that fit any kitchen. Choose according to how much cooking you want to do.

Choose a VM when

You need operating system control, run legacy or licensed software, require special drivers, or are moving an existing server with minimal change.

Choose a platform service when

You want to focus on your application and can accept the platform’s limits. You will save time on patching, scaling and operations.

i
A Common Journey

Many organisations first lift and shift to VMs for speed, then gradually move suitable parts to platform services as they modernise, keeping VMs only where control is truly needed.

18Design Patterns That Work Well

These layouts appear again and again in successful VM-based systems.

Pattern: Three-Tier Application

Web, application and database tiers each live in their own subnet with their own network rules, and each tier has two or more VMs across zones, behind a load balancer.

Pattern: Golden Image Pipeline

An automated pipeline builds, tests and publishes updated images regularly. New machines or scale set instances are created from the latest approved image.

Pattern: Immutable Servers

Instead of logging in and changing machines, you replace them with new ones built from an updated image. This avoids configuration drift and makes rollback simple.

Pattern: Bastion and Private Subnets

All servers have private addresses only, administrators connect through a secure access service, and outbound traffic goes through a NAT gateway or firewall.

Pattern: Scale Out Behind a Load Balancer

Stateless servers in a scale set grow and shrink with demand, while state lives in managed databases, caches and storage.

Pattern: Infrastructure as Code

Machines, disks, networks and rules are defined in templates stored in version control and deployed through pipelines, so environments are repeatable and reviewable.

“Treat servers like cattle, not pets: build them from a recipe, and replace them instead of nursing them.”

19Real-World Examples

Virtual machines quietly power a wide range of everyday systems.

Moving a legacy business application

A company has an accounting package that needs a specific Windows version and a licensed database. It moves to Azure VMs with minimal change, adds backup and a secure access path, and later plans a gradual modernisation.

A festival-season web shop

An online store uses a scale set behind a load balancer. A small base of reserved machines handles normal traffic, and extra instances start automatically during sales and disappear afterwards.

Rendering and simulation

A design studio runs large batches of rendering jobs on GPU and compute-optimised machines, using discounted interruptible capacity, and deletes the machines when the jobs finish.

Large enterprise software

Memory-optimised VMs host large enterprise databases and application servers, spread across zones, with premium storage and carefully planned backup and recovery.

Developer and test environments

Teams create temporary machines from images for testing, shut them down every evening using schedules and remove them at the end of each sprint, keeping non-production costs small.

Specialised infrastructure servers

Domain controllers, file servers and management tools run on VMs inside a protected hub network, supporting the rest of the environment with private connectivity to offices.

Advantages

  • Full control of the operating system and installed software
  • Fast creation, resizing and deletion
  • Wide choice of sizes, including special hardware
  • Easy lift and shift of existing applications
  • Strong options for availability, backup and security

Disadvantages / Trade-offs

  • You must patch, secure and monitor the operating system
  • More operational work than platform services
  • Costs continue while compute is allocated, even when idle
  • Poor design can create single points of failure
  • Configuration drift if machines are changed by hand

20Anti-Patterns to Avoid

These habits regularly lead to break-ins, outages and wasted money.

ANTI-PATTERN-01 Avoid
Problem

Each VM has a public IP address, and remote desktop or secure shell ports are open to the whole internet.

Why It’s Harmful

Automated attackers scan for these ports constantly and try common passwords. A single weak password gives them control of the machine and a base for attacking other systems.

Correct Approach

Keep VMs private, use Azure Bastion or just-in-time access for administration, and place a load balancer or gateway in front of public services.

ANTI-PATTERN-02 Avoid
Problem

An important production application runs on one VM with no backup, no redundancy and no monitoring.

Why It’s Harmful

A hardware fault, maintenance event, deletion or ransomware attack leads to long downtime and permanent data loss.

Correct Approach

Run at least two instances across zones behind a load balancer, enable backup and monitoring, and test recovery regularly.

ANTI-PATTERN-03 Avoid
Problem

Important data is stored on the temporary disk or on the OS disk, and servers are modified by hand over the years.

Why It’s Harmful

Data on the temporary disk can vanish after platform events. Hand-edited servers become unique and fragile, and nobody can rebuild them reliably.

Correct Approach

Keep data on managed data disks or in managed services, build servers from images and templates, and replace instead of hand-repairing.

ANTI-PATTERN-04 Avoid
Problem

Machines are never patched, and secrets such as passwords sit in scripts on the disk.

Why It’s Harmful

Known flaws remain open for months, and anyone who reaches the machine can read the secrets and move to other systems.

Correct Approach

Automate patching with update management or image refresh, use managed identities and Key Vault, and measure compliance regularly.

ANTI-PATTERN-05 Avoid
Problem

Machines are oversized, left running all night and weekends, and there are no tags, budgets or reviews.

Why It’s Harmful

Compute charges for idle capacity make the bill much larger than needed, and nobody knows who owns what or why it exists.

Correct Approach

Right-size using measurements, schedule shutdowns for non-production, tag every resource, set budgets and alerts, and commit only for the steady base.

21Best Practices and a Starter Checklist

Walk through these steps whenever you plan a new virtual machine workload.

1

Confirm that a VM is the right choice

Check whether a platform service could meet the need with less operational work.

2

Choose family, size and generation carefully

Match the family to the workload, prefer current hardware generations and Generation 2 VMs, and check disk and network limits.

3

Design the network

Use private subnets, network security groups, static addresses for key servers and a planned outbound path. Avoid public IPs on servers.

4

Pick disks to match performance needs

Use managed disks, premium types for production data, and never store important data on the temporary disk.

5

Plan availability

Use two or more instances across zones, load balancing and resilient data tiers for important systems.

6

Secure in layers

Patch automatically, use Bastion or just-in-time access, managed identities, Key Vault, disk encryption and endpoint protection.

7

Protect and monitor

Enable backup, plan disaster recovery, turn on boot diagnostics, the monitoring agent and alerts.

8

Automate and control cost

Define everything as code, build from golden images, tag resources, right-size, schedule non-production shutdowns and use reservations for the steady base.

!
Frequent Beginner Mistakes

Opening management ports to the internet, running production on a single machine, using the temporary disk for data, forgetting to deallocate, skipping patching and backups, oversizing, leaving orphaned disks and addresses, and hand-building servers that nobody can recreate.

22Frequently Asked Questions

Q1What is the difference between a VM and a physical server?

A VM behaves like a physical server, but it is created by software on shared hardware. It can be created, resized, copied and deleted in minutes, and you pay by usage, while a physical server needs purchase, delivery and installation.

Q2Does stopping a VM stop the charges?

Only if the VM is deallocated through Azure. A VM shut down from inside its operating system may still be billed for compute. Disks and other attached resources continue to cost money even when compute is off.

Q3What is the temporary disk, and can I keep data on it?

It is fast local storage on the host. Its contents can be lost when the VM is redeployed, resized or moved, so use it only for caches and temporary files. Keep important data on managed data disks.

Q4What is the difference between availability sets and availability zones?

An availability set spreads VMs across racks and update groups inside one data centre. Availability zones spread VMs across separate data centre buildings in a region, which protects against larger failures and generally offers a stronger availability promise.

Q5Who is responsible for patching a VM?

Microsoft patches the physical hosts and hypervisor. You are responsible for the guest operating system and software inside the VM, which you can automate with update management tools or by rebuilding from fresh images.

Q6How do I connect to a VM safely?

Prefer Azure Bastion, a private VPN or other private connection, or just-in-time access, instead of exposing remote desktop or secure shell ports to the internet. Combine with multi-factor authentication and least-privilege access.

Q7When should I use a scale set instead of individual VMs?

Use a scale set when you need many identical, stateless servers that should grow and shrink with demand and be updated or replaced automatically. Use individual VMs for unique, stateful or special-purpose servers.

Q8How do I reduce VM costs?

Right-size using measurements, deallocate or schedule non-production machines, delete orphaned resources, use Hybrid Benefit where eligible, commit with reservations or savings plans for the steady base, and use spot capacity for interruptible work.

Q9Do I need both backup and disaster recovery?

They solve different problems. Backup protects against deletion, corruption and ransomware by letting you restore earlier data. Disaster recovery protects against the loss of a data centre or region by keeping a replica ready to take over. Critical systems usually need both.

Q10Should I use a VM or a platform service for my new application?

If you do not need operating system control, a platform service such as App Service, containers or functions usually means less operational work. Choose a VM when you need control, run legacy or licensed software, or need special drivers or hardware.

23Summary and Key Takeaways

An Azure Virtual Machine is a software-made computer that you rent by the hour and control from the operating system upwards. A VM is a family of linked resources: the machine, its disks, its network interface, its security rules and its address. Success comes from choosing the right size family, using managed disks wisely, keeping machines private, spreading them across zones, patching and securing them in layers, protecting them with backups and monitoring them closely. By building servers from golden images and templates, right-sizing and deallocating idle machines, and choosing platform services where full control is not needed, you can run reliable, secure and economical workloads on Azure.

Key Takeaways

  • A VM is IaaS — Microsoft runs the hardware and hypervisor, and you manage the operating system, software, patching and security inside the machine.
  • A VM is several resources — the machine, OS and data disks, network interface, security group and optional public IP are separate resources that all cost and need managing.
  • Pick the family before the size — match general purpose, compute, memory, storage or GPU families to the workload, measure real use and right-size.
  • Disks and networks decide behaviour — use managed disks of the right type, never keep important data on the temporary disk, and keep servers on private subnets behind controlled front doors.
  • Availability needs design — use two or more instances across zones with load balancing, and make every layer resilient, not just the web tier.
  • Protect and observe — patch regularly, use Bastion or just-in-time access, managed identities and Key Vault, enable backup and recovery plans, and monitor with agents and boot diagnostics.
  • Control cost and prefer automation — deallocate idle machines, use the right pricing model, build from golden images and templates, and choose platform services when you do not need control of the operating system.