What Is a Virtual Machine?
A virtual machine (VM) is a computer made of software. It has a CPU, memory, disk and network like a real computer, but it runs on Azure's physical servers. You choose the operating system (Windows or Linux) and install what you need.
When to Use VMs
- Move an existing application to the cloud without changing it (lift and shift)
- Need full control of the operating system
- Run custom or old software
- Create quick test and development machines
What You Pay For
| Item | Notes |
|---|---|
| Compute | Based on the VM size and time it runs. Stopping (deallocating) the VM stops compute charges |
| Disks | Billed even when the VM is stopped |
| Network and IP address | Public IPs and data leaving Azure may cost |
| License | Windows or SQL licenses may be included, or use Azure Hybrid Benefit |
Sizes
| Family | For |
|---|---|
| General purpose | Everyday apps and web servers |
| Compute optimized | High CPU work |
| Memory optimized | Databases and caches |
| Storage optimized | Large data and disk speed |
| GPU | AI and graphics |
Disks
- OS disk holds the operating system. Data disks hold your data
- Disk types: HDD (cheapest), Standard SSD, Premium SSD and Ultra (fastest)
- Managed disks: Azure handles the storage account for you
Keep VMs Available
| Option | Protects from | Notes |
|---|---|---|
| Availability set | Failures and maintenance inside one datacenter | Spreads VMs across fault domains and update domains |
| Availability zones | A whole datacenter failing | VMs in separate zones. Higher SLA |
| Scale set | Load and failures | Identical VMs that grow and shrink |
Virtual Machine Scale Sets
- A group of identical VMs managed together
- Autoscale: add VMs when CPU is high and remove them when it is low (elasticity)
- Works with a load balancer to spread users
Azure Virtual Desktop
A service that gives users a Windows desktop or apps in the cloud, which they access from any device. Good for remote work.
Create a VM (Steps)
- Search Virtual machines, click Create
- Pick the subscription, resource group, name, region and image (Ubuntu or Windows Server)
- Choose a size, set admin username and SSH key or password
- Check inbound ports (do not open RDP or SSH to the whole internet in real life)
- Review and create. Later stop (deallocate) and delete the resource group
Practice
- What stops compute billing: stopping inside the OS or deallocating in Azure?
- Availability set or zones for the best protection from a datacenter failure?
- What is autoscaling?
Conclusion
A VM is a software computer you control fully (IaaS). Choose size and disks, use availability sets or zones for resilience and scale sets with autoscale for elastic capacity.

