top of page
1 day ago
27 min read

Build it. Connect it. Route it. Break it. Diagnose it. Repair it.

Azure Workshopz | Beyond Cloud with Chriz

Level: AdvancedPlatform: Microsoft AzureTools: Azure CLI, Azure Cloud Shell (Bash)Deployment: Azure CLI only — no Terraform, Bicep, or Azure Portal deployment stepsFocus: Azure Virtual WAN, Hybrid Networking, Site-to-Site VPN, BGP, Route Maps, Route Propagation, NSGs, and Azure MonitorDifficulty: Advanced networking and cloud operationsCost level: High

Introduction

Deploying an Azure Virtual Network is easy.

Connecting two virtual networks is also relatively straightforward.

But what happens when your infrastructure expands across multiple Azure networks, a hybrid branch, and a centralized routing platform?

How do you know which routes are being advertised?

How can you determine whether connectivity fails because of an IPsec tunnel, a missing BGP route, an incorrect routing policy, or a Network Security Group?

And most importantly, how do you restore connectivity without unnecessarily redeploying your infrastructure?

In this workshop, we will build a realistic Azure enterprise networking environment using Azure Virtual WAN.

We will deploy three Azure spoke virtual networks, a regional Virtual Hub, and an Azure-hosted branch that simulates an on-premises network.

The branch connects to Azure Virtual WAN through an IPsec/IKEv2 VPN tunnel with BGP routing enabled.

Once the infrastructure is operational, we'll configure and explore advanced routing policies, deliberately introduce failures, investigate the underlying causes, and restore connectivity.

All deployment, configuration, troubleshooting, and cleanup operations will be performed using Azure CLI.

The goal is not simply to create Azure resources.

The goal is to understand how enterprise networking actually behaves when something goes wrong.

1. What You'll Learn

By the end of this workshop, you will be able to:

  1. Deploy a Standard Azure Virtual WAN.

  2. Create a regional Virtual Hub.

  3. Deploy three spoke VNets with nonoverlapping address spaces.

  4. Connect all spokes to the Virtual Hub.

  5. Deploy an Azure-hosted branch network.

  6. Configure an Azure VPN Gateway to emulate a remote VPN device.

  7. Configure an Azure Virtual WAN Site-to-Site VPN gateway.

  8. Establish an IPsec/IKEv2 VPN tunnel.

  9. Configure and investigate BGP routing.

  10. Inspect Virtual Hub route tables and route propagation.

  11. Create and apply inbound and outbound Route Maps.

  12. Simulate routing-policy failures.

  13. Troubleshoot NSG-related connectivity issues.

  14. Simulate a Site-to-Site VPN outage.

  15. Configure Azure Monitor alerts.

  16. Validate connectivity across the entire environment.

  17. Remove all workshop resources safely.

The operational approach

Every troubleshooting exercise follows the same process:

DEPLOY → VERIFY → BREAK → DIAGNOSE → REPAIR → VERIFY

This ensures that every failure can be linked to a specific change rather than an unknown problem introduced during deployment.

2. Enterprise Network Architecture

Our environment consists of a Standard Virtual WAN, one Virtual Hub, three connected spokes, and a simulated branch network.

                         AZURE CLOUD SHELL
                               |
                            Azure CLI
                               |
                               v
             +----------------------------------+
             |       AZURE VIRTUAL WAN          |
             |          Standard SKU            |
             |                                  |
             |     +----------------------+     |
             |     |   REGIONAL VIRTUAL   |     |
             |     |         HUB          |     |
             |     |                      |     |
             |     |  10.250.0.0/23       |     |
             |     |                      |     |
             |     |  Hub Route Tables    |     |
             |     |  Route Maps          |     |
             |     |  Routing Policies    |     |
             |     |                      |     |
             |     |  S2S VPN Gateway     |     |
             |     +----------+-----------+     |
             |                |                 |
             +----------------+-----------------+
                              |
               +--------------+--------------+
               |              |              |
               v              v              v
        +-------------+ +-------------+ +-------------+
        |   SPOKE A   | |   SPOKE B   | |   SPOKE C   |
        |             | |             | |             |
        |  Web Tier   | |  Data Tier  | | Management  |
        |             | |             | |             |
        |10.61.0.0/16 | |10.62.0.0/16 | |10.63.0.0/16 |
        |             | |             | |             |
        | Ubuntu VM-A | | Ubuntu VM-B | | Ubuntu VM-C |
        +-------------+ +-------------+ +-------------+

                   VIRTUAL WAN VPN GATEWAY
                              |
                         IPsec/IKEv2
                              |
                         BGP Routing
                              |
                              v
                  +----------------------+
                  |    EMULATED BRANCH   |
                  |                      |
                  |   172.16.0.0/16      |
                  |                      |
                  |  Azure VPN Gateway   |
                  |                      |
                  |    Ubuntu VM-BR      |
                  +----------------------+

Why use an Azure-hosted branch?

Normally, a Site-to-Site VPN connects Azure to a physical firewall or VPN router located in an office or datacenter.

For this workshop, we don't need physical infrastructure.

Instead, we will deploy an Azure VPN Gateway into a separate VNet and use it as the simulated branch VPN endpoint.

This gives us a controllable environment for testing hybrid connectivity, BGP and VPN failure recovery.

Important: The branch is intentionally not connected to the Virtual Hub through a VNet connection. Its only route to the spokes will be through the VPN infrastructure.

This preserves the purpose of the hybrid connectivity tests.

The branch gateway uses a single public endpoint for simplicity. The Virtual WAN VPN gateway is managed and redundant, but the simulated branch is not a fully redundant production topology.

3. IP Addressing Plan

Component

Address space

Virtual Hub

10.250.0.0/23

Spoke A

10.61.0.0/16

Spoke A workload subnet

10.61.1.0/24

Spoke B

10.62.0.0/16

Spoke B workload subnet

10.62.1.0/24

Spoke C

10.63.0.0/16

Spoke C workload subnet

10.63.1.0/24

Emulated branch

172.16.0.0/16

Branch workload subnet

172.16.1.0/24

Branch GatewaySubnet

172.16.255.0/27

All networks use unique address spaces.

Address space overlap is a common source of hybrid networking problems and should be prevented before deployment.

BGP configuration

Setting

Value

Branch VPN Gateway ASN

65010

Virtual WAN VPN Gateway ASN

Azure-assigned

BGP peering addresses

Discovered dynamically from Azure

Routing

Dynamic BGP

VPN protocol

IPsec/IKEv2

We will retrieve the actual gateway BGP addresses after provisioning rather than guessing their values.

4. Prerequisites and Cost Warnings

Prerequisites

You need:

  • An active Azure subscription.

  • Contributor or equivalent permissions for all resources.

  • Azure Cloud Shell with Bash.

  • Azure CLI with the virtual-wan extension.

  • Sufficient quota for four Linux VMs.

  • VPN Gateway quota and regional SKU availability.

  • An Azure region supporting Standard Virtual WAN, the selected VPN Gateway SKU, and Route Maps.

  • Permission to create Network Security Groups, public IP addresses, virtual networks, VPN gateways, and monitoring resources.

Cost considerations

This is not a free-tier workshop.

The following resources generate charges:

Azure resource

Billing consideration

Standard Virtual Hub

Hub processing/routing infrastructure

Virtual WAN S2S VPN Gateway

Gateway capacity

Branch Azure VPN Gateway

Gateway runtime

Virtual WAN Route Maps

Additional feature charge

Four Linux VMs

VM compute

Managed disks

Disk storage

Public IP addresses

IP resource charges

Azure Monitor

Monitoring and alert usage

Network traffic

Applicable data processing and transfer

Important: Stopping the Linux VMs does not stop VPN Gateway or Virtual Hub charges.

Gateway deployments can also take a substantial amount of time.

For workshop use, deploy everything into a dedicated resource group and delete it immediately after the exercises.

Before proceeding, review the pricing pages:

No fixed cost estimate is provided because the actual amount depends on the region, selected SKUs, duration, and network usage.

PHASE 1 — Prepare Azure CLI

Step 1 — Open Azure Cloud Shell

Open:

Select Bash.

Verify the Azure CLI installation.

az version

Check the active subscription.

az account show \
  --query "{Name:name,SubscriptionId:id}" \
  --output table

Select your subscription if required.

az account set \
  --subscription "<YOUR-SUBSCRIPTION-ID>"

Step 2 — Install the Virtual WAN extension

az extension add \
  --name virtual-wan \
  --upgrade

Verify:

az extension show \
  --name virtual-wan \
  --query "{Name:name,Version:version}" \
  --output table

Step 3 — Configure workshop variables

The commands below are designed to run in one Bash session. If you close Cloud Shell, restore the variables before continuing.

# General settings
export LOCATION="westeurope"
export SUFFIX=$(openssl rand -hex 3)

# Resource group
export RG="rg-enterprise-networking-$SUFFIX"

# Virtual WAN
export VWAN="vwan-enterprise-$SUFFIX"
export HUB="vhub-enterprise-$SUFFIX"
export HUB_PREFIX="10.250.0.0/23"

# Spoke VNets
export VNET_A="vnet-web-$SUFFIX"
export VNET_B="vnet-data-$SUFFIX"
export VNET_C="vnet-management-$SUFFIX"

# VNet address spaces
export PREFIX_A="10.61.0.0/16"
export PREFIX_B="10.62.0.0/16"
export PREFIX_C="10.63.0.0/16"

# Workload subnet
export SUBNET="snet-workload"

# VMs
export VM_A="vm-web-$SUFFIX"
export VM_B="vm-data-$SUFFIX"
export VM_C="vm-management-$SUFFIX"
export VM_BR="vm-branch-$SUFFIX"

# NSGs
export NSG_A="nsg-web-$SUFFIX"
export NSG_B="nsg-data-$SUFFIX"
export NSG_C="nsg-management-$SUFFIX"
export NSG_BR="nsg-branch-$SUFFIX"

# Virtual Hub connections
export CON_A="conn-web"
export CON_B="conn-data"
export CON_C="conn-management"

# Branch
export BR_VNET="vnet-branch-$SUFFIX"
export BR_PREFIX="172.16.0.0/16"
export BR_GW="vpngw-branch-$SUFFIX"
export BR_PIP="pip-branch-gw-$SUFFIX"
export BR_LNG="lng-vwan-$SUFFIX"
export BR_VPN_CONN="vpn-branch-to-vwan"

# Virtual WAN VPN
export WAN_GW="vpngw-vwan-$SUFFIX"
export VPN_SITE="site-branch-$SUFFIX"
export VPN_LINK="link-branch"
export WAN_VPN_CONN="conn-vwan-to-branch"

# BGP
export BR_ASN=65010

# Route Maps
export ROUTE_MAP="rm-filter-management"
export ISOLATED_RT="rt-isolated"

# Monitoring
export ALERT="alert-vm-cpu-$SUFFIX"

Verify:

echo "Region: $LOCATION"
echo "Resource Group: $RG"
echo "Virtual WAN: $VWAN"
echo "Virtual Hub: $HUB"

Step 4 — Create the resource group

az group create \
  --name "$RG" \
  --location "$LOCATION" \
  --tags Environment=Workshop \
         Project=Azure-Enterprise-Networking

Expected result: Resource group provisioning succeeds.

PHASE 2 — Deploy Azure Virtual WAN

Step 1 — Create the Standard Virtual WAN

az network vwan create \
  --resource-group "$RG" \
  --name "$VWAN" \
  --location "$LOCATION" \
  --type Standard

Verify:

az network vwan show \
  --resource-group "$RG" \
  --name "$VWAN" \
  --query "{Name:name,Type:type,State:provisioningState}" \
  --output table

The WAN type should be Standard.

Step 2 — Create the Virtual Hub

az network vhub create \
  --resource-group "$RG" \
  --name "$HUB" \
  --location "$LOCATION" \
  --vwan "$VWAN" \
  --address-prefix "$HUB_PREFIX" \
  --sku Standard

Verify:

az network vhub show \
  --resource-group "$RG" \
  --name "$HUB" \
  --query "{Name:name,State:provisioningState,AddressPrefix:addressPrefix}" \
  --output table

Continue only when the Virtual Hub is successfully provisioned.

Step 3 — Inspect the default route table

az network vhub route-table list \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --output table

Retrieve its resource ID.

export DEFAULT_RT=$(az network vhub route-table show \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name defaultRouteTable \
  --query id \
  --output tsv)

echo "$DEFAULT_RT"

The default route table will be used for the initial connectivity baseline.

PHASE 3 — Deploy Three Azure Spokes

Step 1 — Create Spoke A

az network vnet create \
  --resource-group "$RG" \
  --name "$VNET_A" \
  --location "$LOCATION" \
  --address-prefixes "$PREFIX_A" \
  --subnet-name "$SUBNET" \
  --subnet-prefixes 10.61.1.0/24

Step 2 — Create Spoke B

az network vnet create \
  --resource-group "$RG" \
  --name "$VNET_B" \
  --location "$LOCATION" \
  --address-prefixes "$PREFIX_B" \
  --subnet-name "$SUBNET" \
  --subnet-prefixes 10.62.1.0/24

Step 3 — Create Spoke C

az network vnet create \
  --resource-group "$RG" \
  --name "$VNET_C" \
  --location "$LOCATION" \
  --address-prefixes "$PREFIX_C" \
  --subnet-name "$SUBNET" \
  --subnet-prefixes 10.63.1.0/24

Step 4 — Verify the address spaces

az network vnet list \
  --resource-group "$RG" \
  --query "[].{Name:name,AddressSpace:addressSpace.addressPrefixes}" \
  --output table

All three spokes should be visible.

Step 5 — Retrieve VNet resource IDs

export VNET_A_ID=$(az network vnet show \
  -g "$RG" -n "$VNET_A" --query id -o tsv)

export VNET_B_ID=$(az network vnet show \
  -g "$RG" -n "$VNET_B" --query id -o tsv)

export VNET_C_ID=$(az network vnet show \
  -g "$RG" -n "$VNET_C" --query id -o tsv)

PHASE 4 — Connect the Spokes to Virtual WAN

All three spokes will associate with and propagate their routes to the hub's default route table.

Connect Spoke A

az network vhub connection create \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$CON_A" \
  --remote-vnet "$VNET_A_ID" \
  --associated-route-table "$DEFAULT_RT" \
  --propagated-route-tables "$DEFAULT_RT" \
  --internet-security false

Connect Spoke B

az network vhub connection create \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$CON_B" \
  --remote-vnet "$VNET_B_ID" \
  --associated-route-table "$DEFAULT_RT" \
  --propagated-route-tables "$DEFAULT_RT" \
  --internet-security false

Connect Spoke C

az network vhub connection create \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$CON_C" \
  --remote-vnet "$VNET_C_ID" \
  --associated-route-table "$DEFAULT_RT" \
  --propagated-route-tables "$DEFAULT_RT" \
  --internet-security false

Verify the connections

az network vhub connection list \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --output table

All connections should reach a successful provisioning state.

Inspect hub routes

az network vhub get-effective-routes \
  --resource-group "$RG" \
  --name "$HUB" \
  --resource-type RouteTable \
  --resource-id "$DEFAULT_RT" \
  --output json

Look for:

10.61.0.0/16
10.62.0.0/16
10.63.0.0/16

Checkpoint: Do not continue until all three spoke prefixes are represented in the effective routing information.

PHASE 5 — Configure Network Security

We'll use TCP port 22 to test connectivity between the Linux VMs.

All VM administration is performed through Azure Run Command, so inbound SSH from the public internet is unnecessary.

Step 1 — Create the NSGs

for NSG in "$NSG_A" "$NSG_B" "$NSG_C" "$NSG_BR"; do
  az network nsg create \
    --resource-group "$RG" \
    --name "$NSG" \
    --location "$LOCATION" \
    --output none
done

Step 2 — Permit private lab traffic

Allow SSH connectivity from the four lab networks.

for NSG in "$NSG_A" "$NSG_B" "$NSG_C" "$NSG_BR"; do
  az network nsg rule create \
    --resource-group "$RG" \
    --nsg-name "$NSG" \
    --name Allow-Lab-SSH \
    --priority 200 \
    --direction Inbound \
    --access Allow \
    --protocol Tcp \
    --source-address-prefixes \
      "$PREFIX_A" "$PREFIX_B" "$PREFIX_C" "$BR_PREFIX" \
    --destination-address-prefixes "*" \
    --destination-port-ranges 22 \
    --output none
done

The rule is limited to the workshop address spaces.

It does not open TCP 22 to arbitrary internet sources.

PHASE 6 — Deploy Linux Test VMs

We need one VM in each spoke.

The VMs will allow us to verify real TCP connections rather than relying only on control-plane state.

We'll use Ubuntu and a small VM size.

The VMs receive Standard public IPs for outbound connectivity. In production, prefer private instances and a controlled outbound connectivity design.

Step 1 — Deploy Web VM

az vm create \
  --resource-group "$RG" \
  --name "$VM_A" \
  --image Ubuntu2204 \
  --size Standard_B1s \
  --admin-username azureuser \
  --generate-ssh-keys \
  --vnet-name "$VNET_A" \
  --subnet "$SUBNET" \
  --nsg "$NSG_A" \
  --nsg-rule NONE \
  --public-ip-sku Standard

Step 2 — Deploy Data VM

az vm create \
  --resource-group "$RG" \
  --name "$VM_B" \
  --image Ubuntu2204 \
  --size Standard_B1s \
  --admin-username azureuser \
  --generate-ssh-keys \
  --vnet-name "$VNET_B" \
  --subnet "$SUBNET" \
  --nsg "$NSG_B" \
  --nsg-rule NONE \
  --public-ip-sku Standard

Step 3 — Deploy Management VM

az vm create \
  --resource-group "$RG" \
  --name "$VM_C" \
  --image Ubuntu2204 \
  --size Standard_B1s \
  --admin-username azureuser \
  --generate-ssh-keys \
  --vnet-name "$VNET_C" \
  --subnet "$SUBNET" \
  --nsg "$NSG_C" \
  --nsg-rule NONE \
  --public-ip-sku Standard

Step 4 — Retrieve private IP addresses

export IP_A=$(az vm show -g "$RG" -n "$VM_A" \
  --show-details --query privateIps -o tsv)

export IP_B=$(az vm show -g "$RG" -n "$VM_B" \
  --show-details --query privateIps -o tsv)

export IP_C=$(az vm show -g "$RG" -n "$VM_C" \
  --show-details --query privateIps -o tsv)

Display:

echo "Web VM:        $IP_A"
echo "Data VM:       $IP_B"
echo "Management VM: $IP_C"

Step 5 — Test Web-to-Data connectivity

az vm run-command invoke \
  --resource-group "$RG" \
  --name "$VM_A" \
  --command-id RunShellScript \
  --scripts \
    "timeout 5 bash -c 'echo >/dev/tcp/${IP_B}/22' && echo 'PASS' || echo 'FAIL'" \
  --query "value[0].message" \
  --output tsv

Expected result:

PASS

Step 6 — Test Web-to-Management connectivity

az vm run-command invoke \
  --resource-group "$RG" \
  --name "$VM_A" \
  --command-id RunShellScript \
  --scripts \
    "timeout 5 bash -c 'echo >/dev/tcp/${IP_C}/22' && echo 'PASS' || echo 'FAIL'" \
  --query "value[0].message" \
  --output tsv

Expected result:

PASS

We now have a working three-spoke Azure Virtual WAN topology.

PHASE 7 — Deploy the Emulated Branch

The next step is adding hybrid connectivity.

We'll create a completely separate VNet with its own Azure VPN Gateway.

Step 1 — Create the branch VNet

az network vnet create \
  --resource-group "$RG" \
  --name "$BR_VNET" \
  --location "$LOCATION" \
  --address-prefixes "$BR_PREFIX" \
  --subnet-name "$SUBNET" \
  --subnet-prefixes 172.16.1.0/24

Step 2 — Create GatewaySubnet

Azure VPN Gateway requires a subnet named exactly GatewaySubnet.

az network vnet subnet create \
  --resource-group "$RG" \
  --vnet-name "$BR_VNET" \
  --name GatewaySubnet \
  --address-prefixes 172.16.255.0/27

Step 3 — Create a public IP for the branch gateway

az network public-ip create \
  --resource-group "$RG" \
  --name "$BR_PIP" \
  --location "$LOCATION" \
  --sku Standard \
  --allocation-method Static

Step 4 — Create the branch VPN Gateway

We will use a route-based gateway with BGP settings.

az network vnet-gateway create \
  --resource-group "$RG" \
  --name "$BR_GW" \
  --location "$LOCATION" \
  --vnet "$BR_VNET" \
  --public-ip-addresses "$BR_PIP" \
  --gateway-type Vpn \
  --vpn-type RouteBased \
  --sku VpnGw1AZ \
  --vpn-gateway-generation Generation2 \
  --asn "$BR_ASN"

Gateway creation is a long-running operation.

Only continue when the provisioning state is Succeeded.

Step 5 — Retrieve the gateway public IP

export BR_PUBLIC_IP=$(az network public-ip show \
  --resource-group "$RG" \
  --name "$BR_PIP" \
  --query ipAddress \
  --output tsv)

echo "$BR_PUBLIC_IP"

Step 6 — Retrieve the gateway BGP settings

az network vnet-gateway show \
  --resource-group "$RG" \
  --name "$BR_GW" \
  --query bgpSettings \
  --output json

Extract the branch BGP peering address:

export BR_BGP_IP=$(az network vnet-gateway show \
  --resource-group "$RG" \
  --name "$BR_GW" \
  --query "bgpSettings.bgpPeeringAddress" \
  --output tsv)

echo "$BR_BGP_IP"

The BGP peering address should be an Azure-assigned private IP from the gateway configuration, not the public VPN endpoint.

Step 7 — Deploy the branch VM

az vm create \
  --resource-group "$RG" \
  --name "$VM_BR" \
  --image Ubuntu2204 \
  --size Standard_B1s \
  --admin-username azureuser \
  --generate-ssh-keys \
  --vnet-name "$BR_VNET" \
  --subnet "$SUBNET" \
  --nsg "$NSG_BR" \
  --nsg-rule NONE \
  --public-ip-sku Standard

Retrieve its private IP.

export IP_BR=$(az vm show \
  --resource-group "$RG" \
  --name "$VM_BR" \
  --show-details \
  --query privateIps \
  --output tsv)

echo "Branch VM: $IP_BR"

Checkpoint: The branch now exists, but it should not yet have private connectivity to the spoke networks.

We have not created the Site-to-Site VPN.

PHASE 8 — Deploy the Virtual WAN VPN Gateway

The branch needs a remote VPN endpoint.

This endpoint will be a Site-to-Site VPN gateway deployed inside the Virtual WAN hub.

Step 1 — Create the hub VPN Gateway

az network vpn-gateway create \
  --resource-group "$RG" \
  --name "$WAN_GW" \
  --location "$LOCATION" \
  --vhub "$HUB" \
  --scale-unit 1

The gateway is a billable Virtual WAN resource.

Wait for successful provisioning before continuing.

Step 2 — Inspect the gateway

az network vpn-gateway show \
  --resource-group "$RG" \
  --name "$WAN_GW" \
  --output json

Focus on:

  • Provisioning state.

  • Public tunnel IP addresses.

  • BGP ASN.

  • BGP peering IP addresses.

Step 3 — Retrieve the Virtual WAN BGP configuration

az network vpn-gateway show \
  --resource-group "$RG" \
  --name "$WAN_GW" \
  --query bgpSettings \
  --output json

For this single-link workshop, select the first hub gateway instance.

export WAN_ASN=$(az network vpn-gateway show \
  -g "$RG" -n "$WAN_GW" \
  --query "bgpSettings.asn" -o tsv)

export WAN_BGP_IP=$(az network vpn-gateway show \
  -g "$RG" -n "$WAN_GW" \
  --query "bgpSettings.bgpPeeringAddresses[0].defaultBgpIpAddresses[0]" \
  -o tsv)

export WAN_TUNNEL_IP=$(az network vpn-gateway show \
  -g "$RG" -n "$WAN_GW" \
  --query "bgpSettings.bgpPeeringAddresses[0].tunnelIpAddresses[0]" \
  -o tsv)

Display the results.

echo "Virtual WAN ASN:       $WAN_ASN"
echo "Virtual WAN BGP IP:    $WAN_BGP_IP"
echo "Virtual WAN tunnel IP: $WAN_TUNNEL_IP"

Verify that all values are populated.

The public tunnel IP and BGP peer address serve different purposes.

The tunnel IP establishes IPsec connectivity, while the BGP peer address is used for routing exchange inside the tunnel.

PHASE 9 — Configure Site-to-Site VPN and BGP

Now we'll establish a Site-to-Site VPN connection between the Azure-hosted branch gateway and the Virtual WAN gateway.

Step 1 — Generate a shared key

The same preshared key must be used on both sides of the VPN.

export VPN_PSK=$(openssl rand -base64 36 | tr -d '=+/')

Keep this value private. Do not print it in screenshots or publish it in source repositories.

Step 2 — Create the Virtual WAN VPN site

The VPN site represents the remote branch gateway.

az network vpn-site create \
  --resource-group "$RG" \
  --name "$VPN_SITE" \
  --location "$LOCATION" \
  --virtual-wan "$VWAN" \
  --ip-address "$BR_PUBLIC_IP" \
  --device-vendor Microsoft \
  --device-model "Azure VPN Gateway" \
  --with-link false

Step 3 — Add the branch VPN link with BGP parameters

az network vpn-site link add \
  --resource-group "$RG" \
  --site-name "$VPN_SITE" \
  --name "$VPN_LINK" \
  --ip-address "$BR_PUBLIC_IP" \
  --asn "$BR_ASN" \
  --bgp-peering-address "$BR_BGP_IP"

Inspect the site links.

az network vpn-site link list \
  --resource-group "$RG" \
  --site-name "$VPN_SITE" \
  --output json

Confirm that the BGP ASN and peer address are correctly assigned to the link.

Step 4 — Retrieve the VPN site ID

export VPN_SITE_ID=$(az network vpn-site show \
  -g "$RG" -n "$VPN_SITE" \
  --query id -o tsv)

Step 5 — Create the Virtual WAN VPN connection

az network vpn-gateway connection create \
  --resource-group "$RG" \
  --gateway-name "$WAN_GW" \
  --name "$WAN_VPN_CONN" \
  --remote-vpn-site "$VPN_SITE_ID" \
  --associated-route-table "$DEFAULT_RT" \
  --propagated-route-tables "$DEFAULT_RT" \
  --connection-bandwidth 100 \
  --protocol-type IKEv2 \
  --shared-key "$VPN_PSK" \
  --enable-bgp true \
  --internet-security false \
  --with-link true

Step 6 — Create the branch Local Network Gateway

On the branch side, the Virtual WAN gateway is represented by a Local Network Gateway.

az network local-gateway create \
  --resource-group "$RG" \
  --name "$BR_LNG" \
  --location "$LOCATION" \
  --gateway-ip-address "$WAN_TUNNEL_IP" \
  --asn "$WAN_ASN" \
  --bgp-peering-address "$WAN_BGP_IP"

Step 7 — Create the branch VPN connection

az network vpn-connection create \
  --resource-group "$RG" \
  --name "$BR_VPN_CONN" \
  --location "$LOCATION" \
  --vnet-gateway1 "$BR_GW" \
  --local-gateway2 "$BR_LNG" \
  --shared-key "$VPN_PSK" \
  --enable-bgp true

Step 8 — Verify VPN connectivity

Check the branch side:

az network vpn-connection show \
  --resource-group "$RG" \
  --name "$BR_VPN_CONN" \
  --query "{Name:name,State:connectionStatus,BGP:enableBgp}" \
  --output table

Check the Virtual WAN side:

az network vpn-gateway connection show \
  --resource-group "$RG" \
  --gateway-name "$WAN_GW" \
  --name "$WAN_VPN_CONN" \
  --output json

The branch VPN connection should eventually report Connected.

If it remains disconnected, check the public endpoints, shared key, IKE settings, and link definitions before continuing.

Step 9 — Inspect BGP peers

az network vnet-gateway list-bgp-peer-status \
  --resource-group "$RG" \
  --name "$BR_GW" \
  --output json

Look for an established BGP session.

Inspect learned routes:

az network vnet-gateway list-learned-routes \
  --resource-group "$RG" \
  --name "$BR_GW" \
  --output table

You should eventually see routes associated with the Azure spokes.

Critical checkpoint: An IPsec tunnel reporting Connected does not prove that BGP has converged or that the remote prefixes are reachable.

Do not continue until the BGP peer is established and the expected routes are present.

This is an Azure-to-Azure simulated branch design. If BGP cannot establish, inspect the discovered gateway peering addresses and site-link configuration rather than replacing them with guessed addresses.

PHASE 10 — Verify Hybrid Connectivity

We now have three spoke VNets and a branch connected through Site-to-Site VPN.

Let's verify end-to-end connectivity.

Step 1 — Test Branch to Web

az vm run-command invoke \
  --resource-group "$RG" \
  --name "$VM_BR" \
  --command-id RunShellScript \
  --scripts \
    "timeout 5 bash -c 'echo >/dev/tcp/${IP_A}/22' && echo 'PASS: Branch to Web' || echo 'FAIL: Branch to Web'" \
  --query "value[0].message" \
  --output tsv

Step 2 — Test Branch to Data

az vm run-command invoke \
  --resource-group "$RG" \
  --name "$VM_BR" \
  --command-id RunShellScript \
  --scripts \
    "timeout 5 bash -c 'echo >/dev/tcp/${IP_B}/22' && echo 'PASS: Branch to Data' || echo 'FAIL: Branch to Data'" \
  --query "value[0].message" \
  --output tsv

Step 3 — Test Branch to Management

az vm run-command invoke \
  --resource-group "$RG" \
  --name "$VM_BR" \
  --command-id RunShellScript \
  --scripts \
    "timeout 5 bash -c 'echo >/dev/tcp/${IP_C}/22' && echo 'PASS: Branch to Management' || echo 'FAIL: Branch to Management'" \
  --query "value[0].message" \
  --output tsv

The expected result is successful private TCP connectivity.

Step 4 — Inspect hub effective routes

az network vhub get-effective-routes \
  --resource-group "$RG" \
  --name "$HUB" \
  --resource-type RouteTable \
  --resource-id "$DEFAULT_RT" \
  --output json

Verify the presence of the branch prefix:

172.16.0.0/16

We have now established our hybrid networking baseline.

PHASE 11 — Configure Azure Virtual WAN Route Maps

Route Maps are used to control routing advertisements entering and leaving Virtual WAN connections.

They can filter or modify supported routes and attributes.

We will create a Route Map that matches the Management VNet prefix:

10.63.0.0/16

The configured action will be Drop.

Step 1 — Create the Route Map

az network vhub route-map create \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$ROUTE_MAP"

Important: The first Route Map creation can trigger an upgrade of the Virtual Hub's routing infrastructure. Microsoft documents an upgrade process of approximately 30 minutes and additional Route Maps charges.

Verify that the hub and Route Map are successfully provisioned before applying the policy to a connection.

az network vhub route-map show \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$ROUTE_MAP" \
  --query "{Name:name,State:provisioningState}" \
  --output table

Step 2 — Create a filtering rule

az network vhub route-map rule add \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --route-map-name "$ROUTE_MAP" \
  --name "Drop-Management-Prefix" \
  --match-criteria "[{\"matchCondition\":\"Equals\",\"routePrefix\":[\"${PREFIX_C}\"]}]" \
  --actions '[{"type":"Drop"}]' \
  --next-step Terminate

Step 3 — Inspect the rule

az network vhub route-map rule list \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --route-map-name "$ROUTE_MAP" \
  --output json

Confirm:

Match:  10.63.0.0/16
Action: Drop

Step 4 — Retrieve the Route Map ID

export ROUTE_MAP_ID=$(az network vhub route-map show \
  -g "$RG" \
  --vhub-name "$HUB" \
  -n "$ROUTE_MAP" \
  --query id \
  -o tsv)

PHASE 12 — BREAK #1: Outbound Route Filtering

Our first simulated incident is a missing route advertisement.

We will apply the Route Map outbound to Spoke A.

This suppresses the Management prefix from the routes advertised toward Spoke A.

Step 1 — Record connection information

export CON_A_ID=$(az network vhub connection show \
  -g "$RG" \
  --vhub-name "$HUB" \
  -n "$CON_A" \
  --query id \
  -o tsv)

Step 2 — Apply the outbound policy

az network vhub connection update \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$CON_A" \
  --associated-outbound-routemap "$ROUTE_MAP_ID"

Step 3 — Verify the association

az network vhub connection show \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$CON_A" \
  --query "routingConfiguration.outboundRouteMap" \
  --output json

Step 4 — Inspect outbound routes

az network vhub route-map get-outbound-routes \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --connection-type HubVirtualNetworkConnection \
  --resource-uri "$CON_A_ID" \
  --output json

After routing convergence, the filtered Management prefix should no longer be advertised through this connection.

Step 5 — Test connectivity

az vm run-command invoke \
  --resource-group "$RG" \
  --name "$VM_A" \
  --command-id RunShellScript \
  --scripts \
    "timeout 5 bash -c 'echo >/dev/tcp/${IP_C}/22' && echo 'PASS' || echo 'FAIL'" \
  --query "value[0].message" \
  --output tsv

Expected result, assuming no alternative route exists:

FAIL

Diagnose

Inspect the hub routing table:

az network vhub get-effective-routes \
  --resource-group "$RG" \
  --name "$HUB" \
  --resource-type RouteTable \
  --resource-id "$DEFAULT_RT" \
  --output json

The hub should still have a route to the Management VNet.

The problem is the outbound route advertisement toward Spoke A.

Repair

Remove the outbound Route Map association.

az network vhub connection update \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$CON_A" \
  --remove routingConfiguration.outboundRouteMap

Retest:

az vm run-command invoke \
  -g "$RG" \
  -n "$VM_A" \
  --command-id RunShellScript \
  --scripts \
    "timeout 5 bash -c 'echo >/dev/tcp/${IP_C}/22' && echo 'PASS: Restored' || echo 'FAIL'" \
  --query "value[0].message" \
  -o tsv

Expected result:

PASS: Restored

PHASE 13 — BREAK #2: Inbound Route Filtering

For the second incident, we'll filter the Management VNet prefix before it enters the Virtual Hub routing table.

This demonstrates a different failure domain.

Step 1 — Apply the Route Map inbound

az network vhub connection update \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$CON_C" \
  --associated-inbound-routemap "$ROUTE_MAP_ID"

Step 2 — Verify the association

az network vhub connection show \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$CON_C" \
  --query "routingConfiguration.inboundRouteMap" \
  --output json

Step 3 — Inspect hub routes

az network vhub get-effective-routes \
  --resource-group "$RG" \
  --name "$HUB" \
  --resource-type RouteTable \
  --resource-id "$DEFAULT_RT" \
  --output json

The filtered prefix should no longer be installed from that inbound connection after routing convergence.

Step 4 — Test connectivity

az vm run-command invoke \
  -g "$RG" \
  -n "$VM_B" \
  --command-id RunShellScript \
  --scripts \
    "timeout 5 bash -c 'echo >/dev/tcp/${IP_C}/22' && echo 'PASS' || echo 'FAIL'" \
  --query "value[0].message" \
  -o tsv

Expected result:

FAIL

Diagnose

Compare the inbound and outbound Route Map behavior.

Outbound filtering: The route remains in the hub but is suppressed toward the selected connection.

Inbound filtering: The filtered route does not enter the hub's route table from the selected connection.

This distinction helps determine the scope of a routing-policy incident.

Repair

az network vhub connection update \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$CON_C" \
  --remove routingConfiguration.inboundRouteMap

Verify routing convergence and repeat the TCP test.

PHASE 14 — BREAK #3: Incorrect Route Propagation

This time, we will simulate an administrator changing route propagation on the Management VNet connection.

The Management network will stop propagating to the default route table.

Step 1 — Create an isolated hub route table

az network vhub route-table create \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$ISOLATED_RT" \
  --labels isolated

Retrieve the resource ID.

export ISOLATED_RT_ID=$(az network vhub route-table show \
  -g "$RG" \
  --vhub-name "$HUB" \
  -n "$ISOLATED_RT" \
  --query id \
  -o tsv)

Step 2 — Change propagation on the Management connection

az network vhub connection update \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$CON_C" \
  --propagated-route-tables "$ISOLATED_RT_ID"

Inspect the result.

az network vhub connection show \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$CON_C" \
  --query routingConfiguration \
  --output json

Ensure that the Management connection is no longer propagating to defaultRouteTable, including through any route-table label.

Step 3 — Diagnose route propagation

az network vhub get-effective-routes \
  --resource-group "$RG" \
  --name "$HUB" \
  --resource-type RouteTable \
  --resource-id "$DEFAULT_RT" \
  --output json

The Management VNet prefix should disappear from the default route table after convergence.

Spokes using that table will no longer have the expected route to Management.

Step 4 — Repair

Restore propagation.

az network vhub connection update \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$CON_C" \
  --propagated-route-tables "$DEFAULT_RT"

Verify that the route returns.

az network vhub get-effective-routes \
  -g "$RG" \
  -n "$HUB" \
  --resource-type RouteTable \
  --resource-id "$DEFAULT_RT" \
  -o json

Key lesson: Route association determines how traffic entering a hub connection is routed. Route propagation determines where routes learned from that connection are distributed.

PHASE 15 — BREAK #4: NSG Connectivity Failure

Not every network failure is a routing failure.

Now we'll simulate a security rule blocking traffic while the routing infrastructure remains healthy.

Step 1 — Create a deny rule

We'll deny TCP port 22 from Spoke A to the Management VNet.

az network nsg rule create \
  --resource-group "$RG" \
  --nsg-name "$NSG_C" \
  --name Deny-Web-SSH \
  --priority 100 \
  --direction Inbound \
  --access Deny \
  --protocol Tcp \
  --source-address-prefixes "$PREFIX_A" \
  --destination-address-prefixes "*" \
  --destination-port-ranges 22

Priority 100 takes precedence over our earlier Allow rule at priority 200.

Step 2 — Test connectivity

az vm run-command invoke \
  -g "$RG" \
  -n "$VM_A" \
  --command-id RunShellScript \
  --scripts \
    "timeout 5 bash -c 'echo >/dev/tcp/${IP_C}/22' && echo 'PASS' || echo 'FAIL'" \
  --query "value[0].message" \
  -o tsv

Expected:

FAIL

Step 3 — Inspect the NSG

az network nsg rule list \
  --resource-group "$RG" \
  --nsg-name "$NSG_C" \
  --query "[].{Name:name,Priority:priority,Access:access,Port:destinationPortRange}" \
  --output table

Identify the deny rule.

Step 4 — Compare routing

az network vhub get-effective-routes \
  --resource-group "$RG" \
  --name "$HUB" \
  --resource-type RouteTable \
  --resource-id "$DEFAULT_RT" \
  --output json

The routes should still be present.

This demonstrates the difference between a routing failure and an NSG enforcement failure.

Step 5 — Repair

az network nsg rule delete \
  --resource-group "$RG" \
  --nsg-name "$NSG_C" \
  --name Deny-Web-SSH

Retest the connection.

az vm run-command invoke \
  -g "$RG" \
  -n "$VM_A" \
  --command-id RunShellScript \
  --scripts \
    "timeout 5 bash -c 'echo >/dev/tcp/${IP_C}/22' && echo 'PASS: Restored' || echo 'FAIL'" \
  --query "value[0].message" \
  -o tsv

Expected:

PASS: Restored

PHASE 16 — BREAK #5: Site-to-Site VPN Outage

Now we'll simulate a hybrid connectivity outage.

We will deliberately remove the Virtual WAN VPN connection to the branch.

The branch's Azure VPN Gateway and its VNet remain deployed, but the connection to the Virtual WAN gateway will be removed.

Step 1 — Verify the baseline

az network vpn-connection show \
  -g "$RG" \
  -n "$BR_VPN_CONN" \
  --query "{Name:name,Status:connectionStatus}" \
  -o table

The connection should be operational before beginning.

Step 2 — Delete the Virtual WAN VPN connection

az network vpn-gateway connection delete \
  --resource-group "$RG" \
  --gateway-name "$WAN_GW" \
  --name "$WAN_VPN_CONN"

This is an intentionally disruptive operation.

Step 3 — Inspect the branch connection

az network vpn-connection show \
  --resource-group "$RG" \
  --name "$BR_VPN_CONN" \
  --query "{Name:name,Status:connectionStatus}" \
  --output table

The branch connection should eventually report a disconnected state.

Step 4 — Inspect BGP

az network vnet-gateway list-bgp-peer-status \
  --resource-group "$RG" \
  --name "$BR_GW" \
  --output json

The BGP session associated with the failed connection should no longer be established.

Step 5 — Inspect hub routes

az network vhub get-effective-routes \
  --resource-group "$RG" \
  --name "$HUB" \
  --resource-type RouteTable \
  --resource-id "$DEFAULT_RT" \
  --output json

Once BGP route withdrawal has converged, the branch prefix should no longer be advertised from this VPN connection.

Step 6 — Test branch connectivity

az vm run-command invoke \
  -g "$RG" \
  -n "$VM_BR" \
  --command-id RunShellScript \
  --scripts \
    "timeout 5 bash -c 'echo >/dev/tcp/${IP_A}/22' && echo 'PASS' || echo 'FAIL'" \
  --query "value[0].message" \
  -o tsv

Expected:

FAIL

Step 7 — Repair the VPN

Recreate the Virtual WAN VPN connection.

az network vpn-gateway connection create \
  --resource-group "$RG" \
  --gateway-name "$WAN_GW" \
  --name "$WAN_VPN_CONN" \
  --remote-vpn-site "$VPN_SITE_ID" \
  --associated-route-table "$DEFAULT_RT" \
  --propagated-route-tables "$DEFAULT_RT" \
  --connection-bandwidth 100 \
  --protocol-type IKEv2 \
  --shared-key "$VPN_PSK" \
  --enable-bgp true \
  --internet-security false \
  --with-link true

Step 8 — Verify restoration

az network vpn-connection show \
  -g "$RG" \
  -n "$BR_VPN_CONN" \
  --query connectionStatus \
  -o tsv

Check BGP again.

az network vnet-gateway list-bgp-peer-status \
  -g "$RG" \
  -n "$BR_GW" \
  -o json

Finally, test branch-to-spoke connectivity.

az vm run-command invoke \
  -g "$RG" \
  -n "$VM_BR" \
  --command-id RunShellScript \
  --scripts \
    "timeout 5 bash -c 'echo >/dev/tcp/${IP_A}/22' && echo 'PASS: VPN restored' || echo 'FAIL'" \
  --query "value[0].message" \
  -o tsv

Expected behavior: Connectivity returns after the IPsec tunnel reconnects, BGP reestablishes, and routes converge.

PHASE 17 — Configure Azure Monitor

Reliable enterprise networking requires monitoring.

In this phase, we'll create a basic Azure Monitor metric alert for the Web VM and inspect network-related Azure Activity Log events.

This is an introduction to observability rather than a full Virtual WAN diagnostic logging deployment.

Step 1 — Retrieve the Web VM resource ID

export VM_A_ID=$(az vm show \
  -g "$RG" \
  -n "$VM_A" \
  --query id \
  -o tsv)

Step 2 — Create a CPU alert

az monitor metrics alert create \
  --resource-group "$RG" \
  --name "$ALERT" \
  --scopes "$VM_A_ID" \
  --condition "avg Percentage CPU > 70" \
  --window-size 5m \
  --evaluation-frequency 1m \
  --description "Workshop Web VM high CPU alert"

This alert evaluates the VM's Percentage CPU metric.

An alert rule does not automatically send email notifications unless an appropriate action group is configured.

Step 3 — Verify the alert

az monitor metrics alert show \
  --resource-group "$RG" \
  --name "$ALERT" \
  --output json

Step 4 — Generate controlled CPU load

az vm run-command invoke \
  --resource-group "$RG" \
  --name "$VM_A" \
  --command-id RunShellScript \
  --scripts \
    "nohup timeout 600 yes > /dev/null 2>&1 < /dev/null & echo 'CPU test started'" \
  --query "value[0].message" \
  --output tsv

Monitor CPU utilization.

az monitor metrics list \
  --resource "$VM_A_ID" \
  --metric "Percentage CPU" \
  --interval PT1M \
  --aggregation Average \
  --output json

If the metric remains above the configured threshold for the required evaluation window, the alert can enter a fired state.

Step 5 — Inspect recent Azure Activity Log events

az monitor activity-log list \
  --resource-group "$RG" \
  --offset 4h \
  --query "[].{Time:eventTimestamp,Operation:operationName.localizedValue,Status:status.localizedValue}" \
  --output table

Review changes involving:

  • Virtual Hub connections.

  • Route Map associations.

  • VPN connections.

  • NSG rule modifications.

The Activity Log records management-plane activity. It does not replace BGP session diagnostics or packet-level traffic monitoring.

PHASE 18 — Final End-to-End Verification

Before cleanup, let's verify the full environment.

Step 1 — Check hub connections

az network vhub connection list \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --output table

Step 2 — Check VPN connectivity

az network vpn-connection show \
  -g "$RG" \
  -n "$BR_VPN_CONN" \
  --query connectionStatus \
  -o tsv

Step 3 — Check BGP

az network vnet-gateway list-bgp-peer-status \
  -g "$RG" \
  -n "$BR_GW" \
  -o json

Step 4 — Inspect the default route table

az network vhub get-effective-routes \
  -g "$RG" \
  -n "$HUB" \
  --resource-type RouteTable \
  --resource-id "$DEFAULT_RT" \
  -o json

Step 5 — Test all workload paths

We'll create a small Bash function to simplify our final tests.

test_path() {
  local SOURCE_VM="$1"
  local TARGET_IP="$2"
  local DESCRIPTION="$3"

  echo "Testing: $DESCRIPTION"

  az vm run-command invoke \
    --resource-group "$RG" \
    --name "$SOURCE_VM" \
    --command-id RunShellScript \
    --scripts \
      "timeout 5 bash -c 'echo >/dev/tcp/${TARGET_IP}/22' && echo 'PASS' || echo 'FAIL'" \
    --query "value[0].message" \
    --output tsv
}

Run the tests.

test_path "$VM_A" "$IP_B" "Web to Data"
test_path "$VM_A" "$IP_C" "Web to Management"

test_path "$VM_B" "$IP_A" "Data to Web"
test_path "$VM_B" "$IP_C" "Data to Management"

test_path "$VM_C" "$IP_A" "Management to Web"
test_path "$VM_C" "$IP_B" "Management to Data"

test_path "$VM_BR" "$IP_A" "Branch to Web"
test_path "$VM_BR" "$IP_B" "Branch to Data"
test_path "$VM_BR" "$IP_C" "Branch to Management"

Expected final connectivity matrix

Source

Destination

Expected

Web

Data

PASS

Web

Management

PASS

Data

Web

PASS

Data

Management

PASS

Management

Web

PASS

Management

Data

PASS

Branch

Web

PASS

Branch

Data

PASS

Branch

Management

PASS

If a test fails, use the troubleshooting procedure below before declaring the workshop complete.

PHASE 19 — Troubleshooting Guide

Scenario 1 — Spokes cannot communicate

Inspect the hub routes:

az network vhub get-effective-routes \
  -g "$RG" \
  -n "$HUB" \
  --resource-type RouteTable \
  --resource-id "$DEFAULT_RT" \
  -o json

Check the relevant VNet connection configuration.

az network vhub connection show \
  -g "$RG" \
  --vhub-name "$HUB" \
  -n "$CON_A" \
  --query routingConfiguration \
  -o json

Look for incorrect associations, propagation, or Route Map policies.

Scenario 2 — VPN tunnel is disconnected

Inspect the branch VPN connection.

az network vpn-connection show \
  -g "$RG" \
  -n "$BR_VPN_CONN" \
  -o json

Check the VPN Gateway configuration and public endpoints.

az network vnet-gateway show \
  -g "$RG" \
  -n "$BR_GW" \
  -o json

Common causes include incorrect preshared keys, tunnel addresses, IPsec configuration, and incomplete gateway provisioning.

Scenario 3 — VPN is connected but BGP fails

az network vnet-gateway list-bgp-peer-status \
  -g "$RG" \
  -n "$BR_GW" \
  -o json

Verify:

  • The local and remote ASNs are different.

  • The BGP peering IP addresses are correct.

  • BGP is enabled on the connection.

  • The VPN site link contains the expected peer configuration.

  • The IPsec tunnel is operational.

Scenario 4 — Routes exist but TCP fails

Investigate:

  • Network Security Groups.

  • VM guest firewall.

  • SSH service status.

  • Source and destination IP addresses.

  • Return-path routing.

A correctly advertised route does not guarantee successful application connectivity.

Scenario 5 — Route Map change causes unexpected impact

Inspect the rules:

az network vhub route-map rule list \
  -g "$RG" \
  --vhub-name "$HUB" \
  --route-map-name "$ROUTE_MAP" \
  -o json

Inspect the connection association:

az network vhub connection show \
  -g "$RG" \
  --vhub-name "$HUB" \
  -n "$CON_A" \
  --query routingConfiguration \
  -o json

If necessary, remove the Route Map association before making further changes.

Always investigate the effective routing state before changing multiple network components.

PHASE 20 — Cleanup

This lab deploys multiple billable gateways and networking services.

Delete the resources after finishing.

Because Virtual WAN resources have dependencies, delete VPN connections and gateways before deleting the entire resource group.

Step 1 — Remove the Route Map associations

If still attached, remove the policies.

az network vhub connection update \
  -g "$RG" \
  --vhub-name "$HUB" \
  -n "$CON_A" \
  --remove routingConfiguration.outboundRouteMap
az network vhub connection update \
  -g "$RG" \
  --vhub-name "$HUB" \
  -n "$CON_C" \
  --remove routingConfiguration.inboundRouteMap

If an association is already absent, no further removal is needed.

Step 2 — Delete the Route Map

az network vhub route-map delete \
  --resource-group "$RG" \
  --vhub-name "$HUB" \
  --name "$ROUTE_MAP" \
  --yes

Step 3 — Delete the branch-side VPN connection

az network vpn-connection delete \
  --resource-group "$RG" \
  --name "$BR_VPN_CONN"

Step 4 — Delete the Virtual WAN VPN connection

az network vpn-gateway connection delete \
  --resource-group "$RG" \
  --gateway-name "$WAN_GW" \
  --name "$WAN_VPN_CONN"

Step 5 — Delete the gateways

Delete the branch gateway.

az network vnet-gateway delete \
  --resource-group "$RG" \
  --name "$BR_GW"

Delete the Virtual WAN VPN gateway.

az network vpn-gateway delete \
  --resource-group "$RG" \
  --name "$WAN_GW"

Step 6 — Delete the resource group

After the dependent VPN resources are deleted:

az group delete \
  --name "$RG" \
  --yes

This removes the remaining spoke resources, hub connections, Virtual WAN, monitoring resources, VMs, public IPs, managed disks, and network configuration.

If Azure reports a dependency conflict, allow the preceding gateway deletion operations to finish and inspect the remaining resources before retrying.

Step 7 — Verify cleanup

az group exists \
  --name "$RG"

Expected:

false

Step 8 — Remove the shared key from the Bash environment

unset VPN_PSK

Cleanup complete.

Workshop Review — What Have We Learned?

This workshop demonstrated multiple Azure networking technologies in one environment.

Technology

Learning outcome

Azure Virtual WAN

Centralized enterprise connectivity

Standard Virtual Hub

Managed routing infrastructure

Hub VNet Connections

Spoke-to-spoke transit

Site-to-Site VPN

Hybrid network connectivity

Azure VPN Gateway

Branch VPN simulation

BGP

Dynamic route exchange

Route Maps

Inbound and outbound filtering

Hub Route Tables

Association and propagation

Network Security Groups

Traffic control

Azure Run Command

Guest-level connectivity verification

Azure Monitor

Metrics and alert configuration

Azure Activity Log

Management-plane change investigation

Azure CLI

Infrastructure operations and automation

Five failures, five lessons

Failure 1 — Outbound Route Map

A route can exist inside the Virtual Hub while being suppressed from advertisements toward a specific connection.

Failure 2 — Inbound Route Map

An inbound routing policy can prevent a prefix from entering the hub's routing table and potentially affect multiple connected networks.

Failure 3 — Incorrect Route Propagation

A healthy VNet connection does not guarantee that its routes are propagated to the route tables where they are needed.

Failure 4 — NSG Deny Rule

Connectivity failures are not always routing failures. Correct routes can coexist with restrictive network security policies.

Failure 5 — Site-to-Site VPN Outage

An IPsec tunnel failure can interrupt dynamic BGP routing and withdraw branch prefixes, affecting hybrid connectivity.

These scenarios represent common categories of problems in enterprise Azure networks.

Final Challenge — Enterprise Network Operations

Before completing the workshop, consider the following questions.

  1. What is the difference between a Virtual WAN hub route table and a subnet route table?

  2. Why do Virtual Hub VNet connections not require direct VNet peering?

  3. What is the difference between the public VPN endpoint and the BGP peer address?

  4. Can an IPsec tunnel report Connected while BGP is not established?

  5. Why is route propagation important for multi-spoke connectivity?

  6. What is the difference between inbound and outbound Route Maps?

  7. How can an NSG block traffic even when effective routes are correct?

  8. What happens to dynamically learned routes when a VPN connection fails?

  9. Why should troubleshooting begin with a verified baseline?

  10. What additional components would be needed to make this network production-ready?

Bonus challenges

For engineers who want to extend this workshop:

Challenge A — Add another Azure region

Deploy a second Virtual Hub and explore inter-hub routing and cross-region connectivity.

Challenge B — Implement redundant branch connectivity

Extend the simulated branch with an active-active VPN Gateway and multiple VPN site links.

Challenge C — Explore BGP route manipulation

Experiment with supported Route Map AS-PATH and BGP Community modifications.

Challenge D — Add network observability

Configure diagnostic settings for the VPN Gateway and collect selected logs in a Log Analytics workspace.

Challenge E — Add network security inspection

Design a separate secured Virtual Hub scenario with Azure Firewall and Routing Intent, respecting the feature compatibility and routing restrictions.

Conclusion

Enterprise Azure networking is much more than creating virtual networks and connecting them together.

A well-designed environment requires understanding how traffic is forwarded, how routes are learned and propagated, how VPN tunnels establish connectivity, and how network security policies affect communication.

In this workshop, we built a multi-spoke Azure Virtual WAN environment, connected a simulated branch through Site-to-Site VPN, introduced BGP routing, and used Route Maps to control route advertisements.

Then we deliberately introduced five different failures and investigated the effects.

The biggest lesson is that successful resource provisioning does not guarantee working network connectivity.

Azure engineers need to understand both the routing control plane and the actual data-plane behavior.

The ability to troubleshoot systematically and restore connectivity is just as important as the ability to deploy infrastructure.

Build. Connect. Route. Break. Diagnose. Repair. Verify.

Official Microsoft Documentation

Azure Workshopz | Beyond Cloud with Chriz

Hands-on Azure workshops for engineers who want to understand how Azure infrastructure actually works.

 
 
 

Comments


bottom of page