Azure Compute & Networking
Azure Compute & Networking
Azure's compute and networking primitives map closely to what you already know from AWS — but the naming, defaults, and mental model differ enough to trip up experienced engineers. This lesson covers the four pillars you will use in every real Azure deployment: Virtual Machines (VMs), Virtual Networks (VNets), Network Security Groups (NSGs), and Load Balancers. We close with the AWS-to-Azure equivalents so you can translate fluently between clouds.
Virtual Machines
Azure VMs live inside a Resource Group — a logical container that scopes billing, RBAC, and lifecycle management. Every resource you create (VM, disk, NIC, public IP) is a separate, addressable object, unlike AWS where some are implicit. This explicitness is a feature: you can delete a VM while retaining its OS disk, or swap a NIC to another VM.
VM sizes follow a naming scheme: Standard_D4s_v5 — family (D = general purpose), vCPUs (4), storage type (s = premium SSD eligible), and generation (v5). For production workloads choose v5 or later; older generations run on aging hardware with lower single-thread performance.
Key flags to internalize: --public-ip-address "" disables a public IP — production VMs should not be directly internet-accessible. --nsg "" skips auto-creation of a per-NIC NSG when you plan to manage NSGs at the subnet level, which is a cleaner security posture at scale. --zone 1 pins the VM to Availability Zone 1; always spread replicas across zones 1, 2, and 3 for HA.
--storage-sku Premium_LRS). They handle redundancy automatically, support snapshots as first-class resources, and are required for Availability Sets to provide the SLA. Unmanaged disks are legacy — never use them in new deployments.
Virtual Networks (VNets)
A VNet is Azure's equivalent of an AWS VPC. You define a CIDR block (e.g., 10.0.0.0/16) and carve it into subnets. Unlike AWS, subnets in a VNet are not Availability-Zone-scoped — a single subnet spans all zones in a region. Zone isolation is enforced at the resource level (VM, Load Balancer frontend IP, etc.), not the subnet level.
A recommended production layout separates concerns into at least three subnets: a frontend subnet (for Application Gateways), an application subnet (for VMs and App Services), and a data subnet (for managed databases). Use /24 blocks or larger — Azure reserves 5 IPs per subnet internally.
Network Security Groups (NSGs)
An NSG is a stateful packet filter — Azure's equivalent of an AWS Security Group, but with two critical differences. First, NSGs can be attached to subnets as well as individual NICs. Second, NSG rules have an explicit priority (100–4096, lower number wins) and can both allow and deny. This enables defense-in-depth: a subnet-level NSG blocks broad categories of traffic, while a per-NIC NSG handles exceptions for individual VMs.
az network watcher test-ip-flow to diagnose this fast.
--source-address-prefixes AzureLoadBalancer allows health probe traffic from the Azure infrastructure, and Internet represents all public IPs. Microsoft maintains these ranges automatically. This is the Azure equivalent of AWS prefix lists for managed services.
Azure Load Balancers
Azure offers two load-balancing products you will encounter constantly: the Standard Load Balancer (Layer 4, TCP/UDP) and the Application Gateway (Layer 7, HTTP/HTTPS). They map roughly to AWS NLB and ALB respectively.
The Standard Load Balancer is the workhorse for internal east-west traffic and VM-to-VM load distribution. Key concepts:
- Frontend IP configuration — a private or public IP the LB listens on. For internal LBs, this is a private IP inside a subnet.
- Backend pool — the set of VMs (or NICs) to distribute traffic to.
- Health probe — TCP or HTTP probe; unhealthy VMs are removed from rotation. Default probe interval is 15 seconds with 2 consecutive failures triggering removal.
- Load balancing rule — maps a frontend port to a backend port with a distribution algorithm (default: 5-tuple hash for persistence).
--enable-tcp-reset true on load balancing rules. Without it, idle connections silently time out and your application gets RST-less socket hangs. With TCP reset enabled, the LB sends RST packets to both sides when a connection goes idle, letting your app fail fast and reconnect cleanly. This is a common source of mysterious connection drops in production.
Cross-Cloud Equivalents
The table below maps the AWS primitives you know to their Azure counterparts. The concepts are identical; the APIs and defaults differ.
- AWS VPC → Azure VNet (subnets are region-wide, not AZ-scoped)
- AWS Security Group → Azure NSG (can attach at subnet or NIC; has explicit deny rules)
- AWS EC2 instance → Azure VM (in a Resource Group; NIC, disk, public IP are separate resources)
- AWS ALB → Azure Application Gateway (Layer 7, WAF-capable)
- AWS NLB → Azure Standard Load Balancer (Layer 4, zone-redundant with Standard SKU)
- AWS Auto Scaling Group → Azure Virtual Machine Scale Sets (VMSS)
- AWS Subnet (per-AZ) → Azure Subnet (region-wide) — zone pinning is per-resource