Virtual Machines: Create & Configure
VMs are the workhorse of Azure compute. Learn how to create a VM, choose the right size, and understand the components that make up a virtual machine in Azure β from the OS disk to the NIC.
What is an Azure VM?
An Azure VM is a computer in the cloud β with a CPU, RAM, storage, and network, just like a physical server.
If youβve managed Hyper-V or VMware on-prem, Azure VMs are the same concept: a virtualised computer running Windows or Linux. The difference is you donβt manage the physical host. You choose a size (CPU + RAM combo), pick an OS image, click create, and in minutes you have a running server.
You pay by the second when the VM is running (with a one-minute minimum). Stop it (deallocate) and you stop paying for compute (but still pay for the disk).
Components of a VM
When you create a VM, Azure creates several resources:
| Component | What It Is | Separate Resource? |
|---|---|---|
| VM | The compute instance (CPU + RAM) | Yes |
| OS Disk | Managed disk with the operating system | Yes |
| Data Disks | Optional additional managed disks | Yes (0 or more) |
| NIC | Network interface card | Yes |
| Public IP | Public-facing IP address (optional) | Yes |
| NSG | Network Security Group (firewall rules) | Yes (can be shared) |
| VNet/Subnet | Virtual network the VM connects to | Yes (can be shared) |
Exam tip: Deleting a VM doesn't delete everything
Deleting a VM resource does NOT automatically delete the OS disk, data disks, NIC, or public IP. You must delete them separately (or check βDelete with VMβ during creation). This is a common exam question and a common gotcha that leads to orphaned resources and unexpected costs.
VM sizes and series
Azure VM sizes follow a naming convention: Family + Subfamily + vCPUs + Features + Version
Example: Standard_D4s_v5 = General purpose (D) + Premium Storage capable (s) + 4 vCPUs + Version 5
| Series | Optimised For | Example Use Case |
|---|---|---|
| B (burstable) | Variable workloads with low baseline CPU | Dev/test, small web servers |
| D (general purpose) | Balanced CPU-to-memory ratio | Most production workloads |
| E (memory optimised) | High memory-to-CPU ratio | Databases, in-memory caching |
| F (compute optimised) | High CPU-to-memory ratio | Batch processing, gaming servers |
| L (storage optimised) | High disk throughput and IOPS | Big data, SQL/NoSQL databases |
| N (GPU) | GPU-accelerated compute | Machine learning, rendering |
| M (memory intensive) | Very high memory (up to 4 TB RAM) | SAP HANA, large databases |
Resizing VMs
You can resize a running VM β with caveats:
- Resize within the same series/family: usually possible without deallocation
- Resize to a different family: may require deallocation (VM stops temporarily)
- Not all sizes are available in all regions or on all hardware clusters
- Check available sizes:
az vm list-vm-resize-options --resource-group myRG --name myVM
Real-world: CloudFirst Labs right-sizes VMs
CloudFirst Labs started with Standard_D4s_v5 (4 vCPU, 16 GB) for their web servers. Azure Advisor showed average CPU usage was only 15%. Alex resized to Standard_D2s_v5 (2 vCPU, 8 GB) β halving the compute cost with no performance impact.
They also use B-series burstable VMs for dev/test environments that are idle 80% of the time. B-series accumulates CPU credits during idle periods and bursts when needed.
| Feature | Azure VMs | On-Prem Hyper-V/VMware |
|---|---|---|
| Provisioning time | Minutes (portal, CLI, template) | Hours to days (hardware, OS install, config) |
| Physical hardware | Managed by Microsoft | You buy, rack, and maintain |
| Scaling | Resize on demand, scale sets | Buy more hardware, migrate VMs |
| Billing | Per-second when running (1-min minimum) | Upfront capital + power/cooling |
| OS patching | Your responsibility (or use Update Management) | Your responsibility |
| Backup | Azure Backup (built-in) | Third-party or custom solution |
Creating a VM
Required decisions at creation:
- Subscription and resource group
- VM name and region
- Availability options (none, availability set, availability zone, scale set)
- Image (OS: Windows Server, Ubuntu, Red Hat, etc.)
- Size (vCPUs + RAM)
- Authentication (password or SSH key for Linux; password for Windows)
- Inbound ports (e.g., RDP 3389 for Windows, SSH 22 for Linux)
- Disks (OS disk type + optional data disks)
- Networking (VNet, subnet, public IP, NSG)
Knowledge check
TechCorp Solutions needs a VM to run their SQL Server database. The database requires 64 GB of RAM and moderate CPU. Which VM series should Alex choose?
Alex deleted a VM from the Azure portal. A week later, he notices the VM's OS disk, NIC, and public IP are still in the resource group. Why?
π¬ Video coming soon