Azure Virtual Machines: Sizes, Images, Disks, Networking, Extensions, Custom Script and Secure Access

Microsoft Azure Architect Technologies AZ 300 60 min min read Updated: Nov 17, 2026 Beginner
Azure Virtual Machines: Sizes, Images, Disks, Networking, Extensions, Custom Script and Secure Access
Beginner Topic 1 of 4

What Is an Azure VM?

A virtual machine (VM) is an on-demand server in Azure. It is IaaS: you pick the size and operating system and you manage updates, software and security inside the VM.

VM Size Families

Family (letter)ExamplesBest for
General purposeB (burstable), D, Dads, DCWeb servers, small databases, dev/test
Compute optimizedFBatch, gaming, web with high CPU
Memory optimizedE, MDatabases, in-memory analytics, SAP
Storage optimizedLBig data, NoSQL with high disk throughput
GPUNAI training, graphics
High performance computeHSimulation, modeling
  • A name like Standard_D4s_v5 means family D, 4 vCPUs, premium storage capable (s), generation v5
  • B-series is cheap and bursts when it has credits. Good for light, spiky loads
  • Arm-based sizes (for example Dps) can be cheaper if your software supports Arm
bash az vm list-sizes --location centralindia --query "[?numberOfCores==\`2\`].{name:name, mem:memoryInMb}" -o table az vm create -g rg-demo -n web01 --image Ubuntu2204 --size Standard_B2s --admin-username azureuser --ssh-key-values ~/.ssh/id_rsa.pub \ --vnet-name vnet-app --subnet web --nsg nsg-web --public-ip-sku Standard --zone 1

Images and Customization

  • Marketplace images: Windows Server, Ubuntu, Red Hat, SQL Server images and many vendor appliances
  • Custom images and the Azure Compute Gallery share your golden image across regions and subscriptions
  • cloud-init (Linux) or Custom Script Extension run setup at first boot
  • VM extensions add features: monitoring agent, antimalware, DSC, Custom Script
bash cat > cloud-init.yaml <<'EOF' #cloud-config package_update: true packages: [nginx] runcmd: - echo "Hello from $(hostname)" > /var/www/html/index.nginx-debian.html EOF az vm create -g rg-demo -n web02 --image Ubuntu2204 --size Standard_B1s --custom-data cloud-init.yaml --admin-username azureuser --generate-ssh-keys az vm open-port -g rg-demo -n web02 --port 80

Managed Disks

Disk typeUse
Standard HDDBackups, infrequent access
Standard SSDWeb servers, light workloads
Premium SSD / Premium SSD v2Production and databases. v2 lets you tune size, IOPS and throughput separately
Ultra DiskVery high IOPS and low latency, such as large databases
  • Each VM has an OS disk, optional data disks and a temporary disk (data is lost on redeploy or move: never keep important data there)
  • Managed disks handle storage accounts for you and support zone-redundant (ZRS) options
  • Encrypted by default with platform-managed keys. You can use customer-managed keys or encryption at host
  • Snapshots and Azure Backup protect disks
bash az disk create -g rg-demo -n data01 --size-gb 128 --sku Premium_LRS az vm disk attach -g rg-demo --vm-name web01 --name data01 az vm update -g rg-demo -n web01 --size Standard_D2s_v5 # resize (VM restarts) az snapshot create -g rg-demo -n snap-web01 --source $(az vm show -g rg-demo -n web01 --query "storageProfile.osDisk.managedDisk.id" -o tsv)

Networking Parts of a VM

  • A VM has one or more network interfaces (NICs) in a subnet of a virtual network
  • Use private IPs and a load balancer or Bastion instead of exposing every VM with a public IP
  • NSGs (network security groups) filter traffic at the subnet or NIC

Secure Access

OptionHow
Azure BastionBrowser or native-client RDP/SSH over TLS from the portal. No public IP and no open 22/3389 on VMs
Just-in-Time (JIT) VM accessDefender for Cloud opens management ports only for a limited time on request
Entra ID login for VMsSign in to Linux and Windows VMs with Entra accounts and RBAC (Virtual Machine Administrator Login)
SSH keys (Linux)Safer than passwords
Managed identityVM gets an identity for Azure resources

Availability and Cost Options

OptionNotes
Availability zonesPlace VMs in different zones. 99.99 percent SLA for two or more zonal VMs
Availability setsSpread across fault and update domains in one datacenter. 99.95 percent SLA
Single VM with Premium SSD99.9 percent SLA
Spot VMsCheap, can be evicted
Reserved instances / savings plansDiscount for steady use
Auto-shutdownSchedule shutdown for dev VMs

SLA numbers are summaries. Check the current Azure SLA documents.

Practice

  1. Create a Linux VM with cloud-init that installs nginx and open it in a browser
  2. Attach a 128 GB Premium SSD data disk, format and mount it
  3. Resize the VM and watch it restart
  4. Connect with Azure Bastion without a public IP
  5. Delete the resource group

Conclusion

Azure VMs are IaaS servers. Choose a size family for the workload, use managed disks and images, automate setup with cloud-init or extensions, reach VMs through Bastion or JIT and use zones for availability.

Quick Summary: VM; sizes; images; disks; networking; access; availability.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators