Domain 3 β€” Module 2 of 7 29%
13 of 27 overall
Domain 3: Deploy and Manage Azure Compute Resources Free ⏱ ~13 min read

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?

Simple explanation

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:

ComponentWhat It IsSeparate Resource?
VMThe compute instance (CPU + RAM)Yes
OS DiskManaged disk with the operating systemYes
Data DisksOptional additional managed disksYes (0 or more)
NICNetwork interface cardYes
Public IPPublic-facing IP address (optional)Yes
NSGNetwork Security Group (firewall rules)Yes (can be shared)
VNet/SubnetVirtual network the VM connects toYes (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

SeriesOptimised ForExample Use Case
B (burstable)Variable workloads with low baseline CPUDev/test, small web servers
D (general purpose)Balanced CPU-to-memory ratioMost production workloads
E (memory optimised)High memory-to-CPU ratioDatabases, in-memory caching
F (compute optimised)High CPU-to-memory ratioBatch processing, gaming servers
L (storage optimised)High disk throughput and IOPSBig data, SQL/NoSQL databases
N (GPU)GPU-accelerated computeMachine 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.

Azure VMs vs On-Prem β€” what changes and what stays the same
FeatureAzure VMsOn-Prem Hyper-V/VMware
Provisioning timeMinutes (portal, CLI, template)Hours to days (hardware, OS install, config)
Physical hardwareManaged by MicrosoftYou buy, rack, and maintain
ScalingResize on demand, scale setsBuy more hardware, migrate VMs
BillingPer-second when running (1-min minimum)Upfront capital + power/cooling
OS patchingYour responsibility (or use Update Management)Your responsibility
BackupAzure Backup (built-in)Third-party or custom solution

Creating a VM

Required decisions at creation:

  1. Subscription and resource group
  2. VM name and region
  3. Availability options (none, availability set, availability zone, scale set)
  4. Image (OS: Windows Server, Ubuntu, Red Hat, etc.)
  5. Size (vCPUs + RAM)
  6. Authentication (password or SSH key for Linux; password for Windows)
  7. Inbound ports (e.g., RDP 3389 for Windows, SSH 22 for Linux)
  8. Disks (OS disk type + optional data disks)
  9. Networking (VNet, subnet, public IP, NSG)
Question

What happens when you delete a VM in Azure?

Click or press Enter to reveal answer

Answer

Only the VM compute resource is deleted by default. The OS disk, data disks, NIC, and public IP are NOT automatically deleted β€” they become orphaned resources that continue to incur costs. Delete them separately or enable 'Delete with VM' at creation.

Click to flip back

Question

What is the difference between stopping (deallocating) and just stopping a VM?

Click or press Enter to reveal answer

Answer

Deallocating (Stop from the portal or az vm deallocate) releases the compute hardware and stops compute billing. Just stopping the OS (shutdown from inside) may not deallocate β€” you could still be billed for the reserved compute. Always deallocate from Azure, not from inside the VM.

Click to flip back

Question

What are B-series VMs best suited for?

Click or press Enter to reveal answer

Answer

B-series (burstable) VMs are ideal for workloads with variable CPU usage β€” low baseline with occasional spikes. They accumulate CPU credits during idle periods and burst above baseline when needed. Perfect for dev/test, small web servers, and low-traffic applications.

Click to flip back

Knowledge check

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?

Knowledge Check

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?