Study guide

2.4 BGP & Custom Route Propagation

Designing and Implementing Microsoft Azure Networking Solutions AZ-700

Track your progress as you read

Finished sections get a check mark.

1 Introduction & AZ-700 Exam Overview

0.1 About the AZ-700 Exam: Format, Scoring & Skills Measured

2 Chapter 1: Azure Virtual Networks, Addressing & Subnet Architecture

1.1 VNet Planning, IP Addressing & Subnet Design 1.2 Virtual Network Peering & Global Peering 1.3 Azure NAT Gateway & Outbound Connectivity 1.4 Azure Virtual Network Manager (AVNM) & Network Groups 1.5 Public IP Addresses, Public IP Prefixes & Custom IP Prefixes (BYOIP)

3 Chapter 2: Azure Name Resolution & Core Routing

2.1 Azure DNS & Private DNS Zones 2.2 Azure Private DNS Resolver & Hybrid Name Resolution 2.3 System Routes & User-Defined Routes (UDR) 2.4 BGP & Custom Route Propagation 2.5 Azure Route Server & Dynamic NVA Route Exchange

4 Chapter 3: Hybrid Connectivity with Azure VPN Gateway

3.1 Azure VPN Gateway Architecture & SKUs 3.2 Site-to-Site (S2S) VPN & High Availability 3.3 Point-to-Site (P2S) VPN & Client Authentication 3.4 Azure Extended Network, Always On VPN & Azure Network Adapter

5 Chapter 4: Azure ExpressRoute & Virtual WAN

4.1 Azure ExpressRoute Architecture & Peering Models 4.2 ExpressRoute Routing, Resiliency & Global Reach 4.3 Azure Virtual WAN Architecture & Hub Routing 4.4 ExpressRoute BFD, Monitoring & Connection Troubleshooting

6 Chapter 5: Regional Load Balancing & Application Gateway

5.1 Azure Load Balancer Architecture & Rules 5.2 Azure Application Gateway Architecture & Routing 5.3 Web Application Firewall (WAF) on Application Gateway 5.4 Inbound NAT Rules, Port Forwarding & Health Probe Design

7 Chapter 6: Global Traffic Management & Azure Front Door

6.1 Azure Front Door Architecture & Routing 6.2 Azure Traffic Manager & DNS Load Balancing 6.3 Load Balancing Decision Matrix & Multi-Tier Design 6.4 Web Application Firewall on Azure Front Door

8 Chapter 7: Azure Private Link & Service Endpoints

7.1 Virtual Network Service Endpoints & Policies 7.2 Azure Private Endpoints & Private Link Architecture 7.3 Private Endpoint DNS Integration & Hybrid Resolution 7.4 Azure Private Link Service for Multi-Tenant Solutions

9 Chapter 8: Network Security Groups & Azure Bastion

8.1 Network Security Groups (NSGs) & Application Security Groups (ASGs) 8.2 Azure Bastion Architecture & Secure Remote Access 8.3 Azure Virtual Network Manager Security Admin Rules

10 Chapter 9: Azure Firewall & Security Policies

9.1 Azure Firewall Architecture & Rule Processing 9.2 Azure Firewall Manager & DDoS Protection

11 Chapter 10: Azure Network Observability & Troubleshooting

10.1 Network Watcher Diagnostic Tools 10.2 NSG Flow Logs, VNet Flow Logs & Traffic Analytics 10.3 Network Troubleshooting Scenarios & End-to-End Connectivity 10.4 Azure Monitor Network Insights & Defender for Cloud Network Posture

2.4 BGP & Custom Route Propagation

Key Takeaways Explain This Topic AI

Azure SDN selects the active route for packet forwarding using Longest Prefix Match (LPM) as the primary criteria; when prefix lengths are identical, route precedence is strictly: User-Defined Route (UDR) > BGP routes > Default System Routes.

Disabling BGP Route Propagation (disableBgpRoutePropagation: true / Propagate gateway routes: Disabled) on a subnet route table blocks gateway-learned routes from populating that subnet, allowing default UDRs (0.0.0.0/0 -> Firewall) to intercept on-premises traffic.

Azure Virtual Network Gateways and Azure Route Server use default Autonomous System Number (ASN) 65515; custom private ASNs must fall within 64512-65534 (16-bit) or 4200000000-4294967294 (32-bit).

Between dynamic routing sources with identical prefix lengths, ExpressRoute BGP routes are preferred over VPN Gateway BGP routes; AS Path prepending can be used on-premises to engineer deterministic failover paths.

Last updated: August 2026

BGP & Custom Route Propagation

Dynamic routing in hybrid enterprise architectures relies on Border Gateway Protocol (BGP) to automatically exchange network reachability information between on-premises datacenters, SD-WAN fabrics, and Azure Virtual Networks. Understanding how Azure evaluates routing conflicts between dynamically learned BGP prefixes, static User-Defined Routes (UDRs), and platform system routes is critical for designing predictable, resilient enterprise networks.

The Longest Prefix Match (LPM) Rule

When a packet arrives at an Azure virtual network interface, the SDN routing engine evaluates all candidate routes in the subnet's Effective Route Table . The primary and most fundamental decision criteria in IP routing is Longest Prefix Match (LPM) . +-----------------------------------------------------------------------------------------+

  • | Longest Prefix Match (LPM) Evaluation |
  • | |
  • | Packet Destination: 10.1.4.55 |
  • | |
  • | Candidate Routes in Effective Table: |
  • | 1. 10.0.0.0/8 (System Route -> None) Prefix Length: /8 |
  • | 2. 10.1.0.0/16 (UDR -> Virtual Appliance 10.0.1.4) Prefix Length: /16 |
  • | 3. 10.1.4.0/24 (BGP Route -> VirtualNetworkGateway) Prefix Length: /24 |
  • | 4. 0.0.0.0/0 (UDR -> Internet) Prefix Length: /0 |
  • | |
  • | >>> WINNING ROUTE: Route 3 (10.1.4.0/24) because /24 is the longest (most specific) |
  • +-----------------------------------------------------------------------------------------+
  • The LPM Principle

Core Rule : A more specific route (longer subnet mask / higher CIDR prefix length) ALWAYS wins over a less specific route, regardless of whether the route originated from a UDR, BGP advertisement, or System Route.

Route Precedence for Identical Prefixes

When multiple routing sources advertise the exact same address prefix (e.g., both a UDR and a BGP advertisement specify 10.20.0.0/16 ), Azure resolves the tie using strict Administrative Precedence : +-----------------------------------------------------------------------------+

  • | Route Precedence Hierarchy (Identical Prefixes) |
  • | |
  • | Rank 1 (Highest): User-Defined Route (UDR) |
  • | v |
  • | Rank 2: BGP Learned Routes (ExpressRoute > VPN) |
  • | v |
  • | Rank 3 (Lowest): Default System Routes |
  • +-----------------------------------------------------------------------------+
  • Detailed Priority Order

User-Defined Route (UDR) :

Highest administrative priority.

Explicitly designed to allow administrators to override dynamic routing behavior.

BGP Learned Routes :

Routes propagated dynamically via ExpressRoute, S2S VPN, or Azure Route Server.

Dynamic Route Sub-Precedence :

If the identical prefix is advertised over both ExpressRoute and VPN Gateway, ExpressRoute is preferred over VPN .

If multiple BGP paths exist across the same connection type, the route with the shortest AS Path is selected.

Default System Routes :

Lowest priority.

Overridden automatically by any matching UDR or BGP route.

Disabling BGP Route Propagation ( DisableGatewaySubnetRoutes )

By default, when a Route Table is created, the property Propagate gateway routes is enabled ( disableBgpRoutePropagation: false ). This means all BGP routes learned by the Virtual Network Gateway are automatically injected into the subnet's effective route table.

The Enterprise Firewall Bypass Problem

Consider an enterprise hub-and-spoke network with an Azure Firewall in the hub and a default UDR 0.0.0.0/0 -> 10.0.1.4 on the spoke subnet. The on-premises network advertises specific branch subnets (e.g., 172.16.50.0/24 ) via BGP over ExpressRoute. +-----------------------------------------------------------------------------------------+

  • | Scenario A: Propagate Gateway Routes ENABLED (Firewall Bypassed) |
  • | |
  • | Effective Routes on Spoke Subnet: |
  • | - 0.0.0.0/0 -> UDR: Azure Firewall (10.0.1.4) |
  • | - 172.16.50.0/24 -> BGP: VirtualNetworkGateway (Learned from On-Premises) |
  • | |
  • | Result: Packet to 172.16.50.10 matches 172.16.50.0/24 via LPM. |
  • | Traffic flows DIRECTLY to Gateway, completely bypassing Azure Firewall inspection! |
  • +-----------------------------------------------------------------------------------------+

vs.

  • +-----------------------------------------------------------------------------------------+
  • | Scenario B: Propagate Gateway Routes DISABLED (Enforced Inspection) |
  • | |
  • | Effective Routes on Spoke Subnet: |
  • | - 0.0.0.0/0 -> UDR: Azure Firewall (10.0.1.4) |
  • | (BGP route 172.16.50.0/24 is BLOCKED from entering the subnet route table) |
  • | |
  • | Result: Packet to 172.16.50.10 matches 0.0.0.0/0. |
  • | Traffic is forced through Azure Firewall (10.0.1.4) for full security inspection! |
  • +-----------------------------------------------------------------------------------------+
  • Implementation

To enforce security inspection, set disableBgpRoutePropagation: true on the spoke route table. This ensures that no learned BGP routes override your summary UDRs. // Azure Bicep: Spoke Route Table with BGP Propagation Disabled

  • resource spokeRouteTable 'Microsoft.Network/routeTables@2023-05-01' = {
  • name: 'rt-spoke-isolated'
  • location: 'eastus'
  • properties: {
  • disableBgpRoutePropagation: true // Blocks learned BGP routes from injecting
  • routes: [
  • {
  • name: 'force-all-traffic-to-firewall'
  • properties: {
  • addressPrefix: '0.0.0.0/0'
  • nextHopType: 'VirtualAppliance'
  • nextHopIpAddress: '10.0.1.4'
  • }
  • }
  • ]
  • }
  • }
  • Autonomous System Numbers (ASN) & BGP Configuration

BGP uses Autonomous System Numbers (ASNs) to identify routing domains and prevent routing loops.

Azure ASN Allocations & Constraints

ASN Classification ASN Range / Value Rules & Usage in Azure

Azure Default ASN 65515 Default ASN assigned to Azure Virtual Network Gateways, VPN Gateways, and Azure Route Server.

Supported 16-Bit Private ASNs 64512 – 65534 Available for customer on-premises routers and custom Azure Gateway configurations.

Supported 32-Bit Private ASNs 4200000000 – 4294967294 Fully supported for 4-byte ASN dynamic peering in modern enterprise networks.

Reserved / Prohibited ASNs 65515 , 65520 , 65535 , 8075 , 12076 Cannot be used for customer on-premises ASNs. 8075 and 12076 are Microsoft public ASNs.

BGP Peering Addresses

Azure VPN Gateway : Assigns private IP addresses from the GatewaySubnet as BGP peer addresses. It also supports APIPA (Automatic Private IP Addressing) addresses in the range 169.254.21.0/24 to 169.254.22.255/24 for multi-S2S tunnels.

Azure Route Server : Establishes eBGP peering sessions with third-party NVAs using standard VNet subnet IP addresses.

BGP Communities in Azure Networking

In ExpressRoute Microsoft Peering, Microsoft advertises public IP prefixes for Azure services (Storage, SQL, Cosmos DB). To allow customers to filter routes and control traffic paths, Microsoft tags prefixes with BGP Communities :

Regional BGP Communities :

Format: 12076:51004 (East US), 12076:51005 (West US), 12076:52001 (North Europe).

Allows on-premises routers to prefer local regional Azure paths.

Service BGP Communities :

Format: 12076:5010 (Azure Storage), 12076:5020 (Azure SQL), 12076:5050 (Azure Cosmos DB), 12076:5250 (Azure Monitor).

Allows enterprises to accept routes only for specific approved cloud services over ExpressRoute.

Comprehensive Azure Routing Decision Matrix

Destination IP Candidate Route A Candidate Route B Candidate Route C Winning Route Deterministic Reason

10.5.1.20 10.5.0.0/16 (UDR -> NVA) 10.5.1.0/24 (BGP -> Gateway) 0.0.0.0/0 (UDR -> Internet) Candidate B ( 10.5.1.0/24 ) Longest Prefix Match ( /24 > /16 > /0 ).

10.2.0.10 10.2.0.0/16 (UDR -> NVA) 10.2.0.0/16 (BGP -> Gateway) 10.0.0.0/8 (System -> None) Candidate A ( 10.2.0.0/16 UDR) Identical prefix: UDR takes precedence over BGP.

172.16.1.5 172.16.0.0/16 (BGP ExpressRoute) 172.16.0.0/16 (BGP VPN) 172.16.0.0/12 (System -> None) Candidate A (ExpressRoute) Identical prefix: ExpressRoute BGP beats VPN BGP.

192.168.1.50 0.0.0.0/0 (UDR -> NVA) 192.168.0.0/16 (BGP Gateway) None (BGP Propagation Disabled) Candidate A ( 0.0.0.0/0 UDR) BGP propagation disabled; BGP route excluded from table.

Loading diagram... Azure Routing Decision Logic Flowchart