Hub-Spoke Network Architecture in Azure

The hub-spoke topology is a network design pattern that uses a central hub virtual network (VNet) to manage connectivity and security for multiple spoke VNets. This architecture provides a scalable and manageable way to connect workloads across Azure and to on-premises environments.

Diagram of Azure Hub-Spoke Network Architecture

Key Components

Benefits of Hub-Spoke

Implementing Hub-Spoke

1. Design the Hub VNet

Plan the address space for your hub VNet, ensuring it doesn't overlap with any connected spoke or on-premises networks. Deploy shared services like Azure Firewall or NVAs.

2. Create Spoke VNets

For each spoke VNet, define its address space and deploy the workloads. Ensure no IP address conflicts.

3. Establish VNet Peering

Create peering connections from each spoke VNet to the hub VNet. Crucially, enable Gateway Transit on the spoke-to-hub peering and Allow Gateway Transit on the hub-to-spoke peering.

Important: A VNet cannot have a virtual network gateway and also have Allow Gateway Transit enabled on its peering. The hub typically has the gateway and allows transit, while spokes peer to the hub and enable transit.

4. Configure Routing

Use User Defined Routes (UDRs) on spoke subnets to force traffic through the hub's firewall or NVAs for inspection and routing. The hub's routing will then direct traffic to its destination.


# Example of creating a UDR to route traffic to a firewall in the hub
az network route-table create --resource-group MyResourceGroup --name SpokeRouteTable

az network route-table route create --resource-table-name SpokeRouteTable \
    --resource-group MyResourceGroup --name ToHubFirewall \
    --address-prefix 0.0.0.0/0 \
    --next-hop-type VirtualAppliance \
    --next-hop-ip-address <HUB_FIREWALL_PRIVATE_IP>

az network subnet update --resource-group MyResourceGroup --vnet-name MySpokeVNet \
    --name MySpokeSubnet --route-table MyResourceGroup/SpokeRouteTable
            

5. Deploy Shared Services

Deploy services like Azure Firewall, Azure Load Balancer, or NVAs in the hub to manage traffic flow, security, and other shared network functions.

Considerations

For large-scale deployments, consider using Azure Virtual WAN, which provides a fully managed hub-spoke network architecture that simplifies deployment and management.