AzureIntermediate

Azure Networking Deep Dive: VNet, ExpressRoute, and Load Balancers

10 min read

TL;DR

Master Azure networking with this comprehensive guide covering Virtual Networks, ExpressRoute, Load Balancers, and advanced networking concepts for enterprise deployments.

Azure Networking Deep Dive: VNet, ExpressRoute, and Load Balancers

Executive Summary

Azure networking is a set of layered decisions: address space and segmentation inside virtual networks, how traffic between networks and on-premises sites is routed, and which of four load-balancing services sits in front of a workload. This guide covers VNet design, network security groups, ExpressRoute hybrid connectivity, and the Azure Load Balancer, Application Gateway, and Front Door family, with the configuration for each. After reading it you will be able to lay out a hub-and-spoke network that can grow, choose the right traffic distribution service for a given protocol and scope, and debug connectivity failures in the order they actually occur.

Why This Matters

Network design errors are among the most expensive to unwind in Azure. Overlapping address ranges block VNet peering and VPN connections the day two networks need to join. A flat network with permissive security groups passes its first audit exactly once. And the wrong load balancer choice — a Layer 4 balancer in front of an application that needs path-based routing and TLS termination — means a redesign under delivery pressure. Networks also fail quietly: an asymmetric route or a missing NSG rule produces intermittent timeouts that look like application bugs and consume weeks.

Core Concepts

Virtual Networks and Address Planning

A VNet is your private address space in Azure, divided into subnets that hold resources. Address planning is the one decision to make slowly: use private ranges that do not overlap with on-premises networks, other VNets you may peer with, or the ranges Azure services reserve for themselves. Size subnets for growth — a subnet cannot be resized casually once resources sit in it — and reserve dedicated subnets for the services that require them, such as Azure Firewall, VPN/ExpressRoute gateways (the GatewaySubnet), and Application Gateway.

# Create a resource group
az group create \
    --name NetworkingRG \
    --location eastus

# Create a virtual network
az network vnet create \
    --resource-group NetworkingRG \
    --name MyVNet \
    --address-prefix 10.0.0.0/16 \
    --subnet-name Frontend \
    --subnet-prefix 10.0.1.0/24

# Add additional subnet
az network vnet subnet create \
    --resource-group NetworkingRG \
    --vnet-name MyVNet \
    --name Backend \
    --address-prefix 10.0.2.0/24

For estates beyond one network, the hub-and-spoke topology is the standard pattern: a hub VNet holds shared services (firewall, gateways, DNS), spoke VNets hold workloads, and peerings connect spokes to the hub. Spokes do not peer with each other, so traffic between workloads passes the hub's inspection point.

Network Security Groups

NSGs are stateful packet filters attached to subnets or network interfaces, evaluated by priority. Rules are allow or deny on protocol, ports, and source/destination prefixes, and service tags (such as Internet, VirtualNetwork, or a service's tag) keep rules readable as addresses change.

{
    "name": "MyNSG",
    "type": "Microsoft.Network/networkSecurityGroups",
    "apiVersion": "2021-02-01",
    "location": "[resourceGroup().location]",
    "properties": {
        "securityRules": [
            {
                "name": "AllowHTTPS",
                "properties": {
                    "protocol": "Tcp",
                    "sourcePortRange": "*",
                    "destinationPortRange": "443",
                    "sourceAddressPrefix": "Internet",
                    "destinationAddressPrefix": "*",
                    "access": "Allow",
                    "priority": 100,
                    "direction": "Inbound"
                }
            },
            {
                "name": "DenyAllInbound",
                "properties": {
                    "protocol": "*",
                    "sourcePortRange": "*",
                    "destinationPortRange": "*",
                    "sourceAddressPrefix": "*",
                    "destinationAddressPrefix": "*",
                    "access": "Deny",
                    "priority": 4096,
                    "direction": "Inbound"
                }
            }
        ]
    }
}

Two operational facts matter: default rules already deny unsolicited inbound traffic from the internet, and when NSGs sit on both a subnet and a NIC, both must allow the traffic. Most "the port is open but nothing connects" incidents are an NSG or a route, and NSG flow logs are how you prove which.

Routing

Azure routes traffic between subnets and to the internet by default using system routes. User-defined routes (route tables) override that behaviour — most importantly to force traffic through a firewall in the hub. BGP, learned over ExpressRoute or VPN gateways, advertises on-premises prefixes into Azure and back. The debugging order for connectivity is consistent: effective routes on the NIC, then effective NSG rules, then the appliance in the path.

ExpressRoute: Private Hybrid Connectivity

ExpressRoute is a private connection from your site or colocation into Microsoft's network, provisioned through a connectivity provider. Unlike a VPN over the internet, it offers predictable latency and bandwidth, and traffic never traverses the public internet. A circuit is provisioned with a provider and peering location, then configured with private peering for VNet connectivity:

# Create ExpressRoute circuit
New-AzExpressRouteCircuit `
    -Name "MyCircuit" `
    -ResourceGroupName "NetworkingRG" `
    -Location "East US" `
    -SkuTier "Premium" `
    -SkuFamily "MeteredData" `
    -ServiceProviderName "Equinix" `
    -PeeringLocation "Washington DC" `
    -BandwidthInMbps 1000

# Configure private peering
$circuit = Get-AzExpressRouteCircuit -Name "MyCircuit" -ResourceGroupName "NetworkingRG"
Add-AzExpressRouteCircuitPeeringConfig `
    -Name "AzurePrivatePeering" `
    -ExpressRouteCircuit $circuit `
    -PeeringType AzurePrivatePeering `
    -PeerASN 65001 `
    -PrimaryPeerAddressPrefix "172.16.0.0/30" `
    -SecondaryPeerAddressPrefix "172.16.0.4/30" `
    -VlanId 100

The circuit connects to VNets through an ExpressRoute gateway in the GatewaySubnet:

{
    "name": "MyExpressRouteGateway",
    "type": "Microsoft.Network/virtualNetworkGateways",
    "apiVersion": "2021-02-01",
    "location": "[resourceGroup().location]",
    "properties": {
        "ipConfigurations": [
            {
                "name": "default",
                "properties": {
                    "privateIPAllocationMethod": "Dynamic",
                    "subnet": {
                        "id": "[variables('gatewaySubnetId')]"
                    },
                    "publicIPAddress": {
                        "id": "[variables('publicIPId')]"
                    }
                }
            }
        ],
        "gatewayType": "ExpressRoute",
        "sku": {
            "name": "ErGw1AZ",
            "tier": "ErGw1AZ"
        }
    }
}

Plan for the lead time: circuit provisioning involves the provider and physical cross-connects, and is measured in weeks. A site-to-site VPN is the usual interim and the usual backup path, with route weights deciding which path wins.

Load Balancing: Four Services, Two Layers

ServiceLayerScopeUse it for
Azure Load Balancer4 (TCP/UDP)RegionalNon-HTTP protocols, raw TCP/UDP distribution to VMs
Application Gateway7 (HTTP/S)RegionalPath and host routing, TLS termination, WAF
Azure Front Door7 (HTTP/S)GlobalMulti-region web apps, global failover, edge caching
Traffic ManagerDNSGlobalDNS-based distribution; no data path, no failover speed of the data-plane services

A Standard Load Balancer is a frontend IP, a backend pool, a health probe, and rules tying them together:

# Create public IP
az network public-ip create \
    --resource-group NetworkingRG \
    --name MyPublicIP \
    --sku Standard

# Create load balancer
az network lb create \
    --resource-group NetworkingRG \
    --name MyLoadBalancer \
    --sku Standard \
    --public-ip-address MyPublicIP \
    --frontend-ip-name MyFrontend \
    --backend-pool-name MyBackendPool

# Add health probe
az network lb probe create \
    --resource-group NetworkingRG \
    --lb-name MyLoadBalancer \
    --name MyHealthProbe \
    --protocol tcp \
    --port 80

# Add load balancing rule
az network lb rule create \
    --resource-group NetworkingRG \
    --lb-name MyLoadBalancer \
    --name MyLoadBalancerRule \
    --protocol tcp \
    --frontend-port 80 \
    --backend-port 80 \
    --frontend-ip-name MyFrontend \
    --backend-pool-name MyBackendPool \
    --probe-name MyHealthProbe

The probe is the component everyone forgets: if the probe path or port does not match what the application actually serves, the balancer marks every backend unhealthy and the outage looks like the application died.

Centralised Filtering: Azure Firewall

In a hub-and-spoke design, Azure Firewall in the hub inspects traffic between spokes, to the internet, and to on-premises. Application rules filter outbound traffic by FQDN — the control that stops workloads reaching arbitrary internet endpoints:

{
    "name": "MyAzureFirewall",
    "type": "Microsoft.Network/azureFirewalls",
    "apiVersion": "2021-02-01",
    "location": "[resourceGroup().location]",
    "properties": {
        "applicationRuleCollections": [
            {
                "name": "AllowWeb",
                "properties": {
                    "priority": 100,
                    "action": {
                        "type": "Allow"
                    },
                    "rules": [
                        {
                            "name": "AllowHTTPS",
                            "protocols": [
                                {
                                    "protocolType": "Https",
                                    "port": 443
                                }
                            ],
                            "targetFqdns": [
                                "*.microsoft.com"
                            ]
                        }
                    ]
                }
            }
        ]
    }
}

Route tables on spoke subnets send traffic to the firewall; without them, the firewall inspects nothing.

Observability: Network Watcher and Flow Logs

Network Watcher provides the diagnostics — connection troubleshooting, effective routes and rules, packet capture — and flow logs record the traffic NSGs allowed or denied:

# Configure flow logs
$nsg = Get-AzNetworkSecurityGroup -Name "MyNSG" -ResourceGroupName "NetworkingRG"
$workspace = Get-AzOperationalInsightsWorkspace -Name "MyWorkspace" -ResourceGroupName "NetworkingRG"

Set-AzNetworkWatcherFlowLog `
    -NetworkWatcher $networkWatcher `
    -TargetResourceId $nsg.Id `
    -StorageAccountId $storageAccount.Id `
    -EnableFlowLog $true `
    -WorkspaceId $workspace.ResourceId `
    -WorkspaceRegion $workspace.Location `
    -WorkspaceResourceId $workspace.ResourceId

Enable flow logs before you need them; they cannot be reconstructed after an incident.

Decision Framework

SituationRecommendation
HTTP application in one region needing path routing or WAFApplication Gateway
TCP/UDP service or VM fleet in one regionStandard Load Balancer
Web application served from multiple regionsFront Door in front of regional entry points
Hybrid connectivity, predictable performance, compliance-sensitiveExpressRoute, with VPN as backup path
Hybrid connectivity, small site, cost-sensitiveSite-to-site VPN gateway
Multiple VNets and teamsHub-and-spoke: shared firewall, gateways, and DNS in the hub; workload spokes peered to it
Outbound internet access must be controlledAzure Firewall in the hub with FQDN application rules and forced tunnelling routes

Implementation Checklist

  • [ ] Address plan documented and checked for overlap against on-premises, other VNets, and planned regions
  • [ ] Dedicated subnets reserved for gateway, firewall, and Application Gateway before workloads are placed
  • [ ] NSGs applied per subnet with least-privilege rules; no permanent allow-any rules outside a reviewed exception
  • [ ] NSG flow logs enabled and flowing to Log Analytics
  • [ ] Health probes match the application's real health endpoint and port
  • [ ] ExpressRoute or VPN gateway SKU sized for expected throughput; backup path tested, not assumed
  • [ ] Route tables verified with effective routes on a NIC in each spoke
  • [ ] Accelerated networking enabled on VM sizes that support it for latency-sensitive workloads
  • [ ] DNS design decided: Azure Private DNS zones linked to hub and spokes consistently
  • Trade-offs

    Hub-and-spoke centralises control and inspection, at the cost of the hub becoming critical infrastructure and a potential throughput bottleneck; traffic hairpinning through the hub adds latency for spoke-to-spoke flows. ExpressRoute buys predictable private connectivity with provider lead times and recurring circuit cost that a VPN avoids. Layer 7 services terminate TLS and route intelligently, which means they also become the place where certificates, WAF rules, and header behaviour must be operated. Every inspection point you add is also a failure point you own.

    When Not to Use

  • Azure Load Balancer is the wrong choice for HTTP workloads needing path-based routing, TLS termination, or a WAF; use Application Gateway regionally or Front Door globally.
  • ExpressRoute is the wrong choice for a small or temporary site where a VPN gateway meets the bandwidth and latency needs — circuit cost and provisioning time are hard to justify.
  • Peering every VNet to every other VNet is the wrong choice beyond a handful of networks; the mesh becomes unmanageable and bypasses central inspection. Use hub-and-spoke.
  • Traffic Manager is the wrong choice when failover must be fast or health must reflect the data path; DNS TTLs decide your failover time, not your intentions.
  • Conclusion

    Design the address space and topology first, segment with NSGs and a hub firewall second, and pick the load-balancing service by layer and scope last. Most Azure network incidents are routing or filtering problems wearing an application costume — effective routes, effective rules, and flow logs are how you prove it quickly when they happen.

    Why This Matters

    Understanding the business and technical context helps you make informed decisions rather than blindly following patterns.

    Trade-offs to Consider

    Every architectural decision involves trade-offs. Consider your specific requirements, team expertise, and scale when evaluating options.

    When NOT to Use This

    Knowing when a solution doesn't apply is as valuable as knowing when it does. Consider alternatives for your specific situation.

    Decision Framework

    Use this framework to evaluate whether this approach is right for your use case based on your specific constraints and requirements.

    Share this articleShare on XShare on LinkedIn

    Keep the decision frameworks coming

    One practical architecture guide a week — patterns, trade-offs, and when not to use them. No spam, unsubscribe anytime.