# Azure Bgp

> Analyze and resolve BGP oscillation and BGP route leaks in Azure Virtual WAN–style hub-and-spoke topologies (and similar cloud-managed BGP environments). Detect preference cycles, identify valley-free violations, and propose allowed policy-level mitigations while rejecting prohibited fixes.

- Skill: `bishal-pdmsft/azure-bgp-4` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx get-skill add bishal-pdmsft/azure-bgp-4`
- Raw SKILL.md: https://api.skillmd.com/api/skills/bishal-pdmsft/azure-bgp-4/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: bishal-pdMSFT (https://skillmd.com/u/bishal-pdmsft)
- Updated: 2026-11-15
- Page: https://skillmd.com/skills/bishal-pdmsft/azure-bgp-4

---


# Azure BGP Oscillation & Route Leak Analysis

Analyze and resolve BGP oscillation and BGP route leaks in Azure Virtual WAN–style hub-and-spoke topologies (and similar cloud-managed BGP environments).

## Required Reading Order

Before performing any analysis, read the companion preflight document in this skill folder:

> **`PREFLIGHT.md`** — mandatory control-plane input hygiene steps. These must be executed before Step 1 of the reasoning workflow. Skipping them produces biased oscillation and leak verdicts on clean topologies.

The rest of this document describes detection and fix-selection logic once preflight is complete.

## When to Use This Skill

Use this skill when a task involves:

- Azure Virtual WAN, hub-and-spoke BGP, ExpressRoute, or VPN gateways
- Repeated route flapping or unstable path selection
- Unexpected transit, leaked prefixes, or valley-free violations
- Choosing between routing intent, UDRs, or BGP policy fixes
- Evaluating whether a proposed "fix" is valid in Azure

## Core Invariants (Must Never Be Violated)

- ❌ BGP sessions between hubs **cannot** be administratively disabled by customers as it's owned by azure
- ❌ Peering connections **cannot** be shut down as a fix as it break all other traffic running on the connections
- ❌ Removing connectivity is **not** a valid solution as it break all other traffic running
- ✅ Problems **must** be fixed using routing policy, not topology destruction

## Expected Inputs

| File | Meaning |
|------|---------|
| `topology.json` | Directed BGP adjacency graph |
| `relationships.json` | Economic relationship per edge (provider, customer, peer) |
| `preferences.json` | Per-ASN preferred next hop (may cause oscillation) |
| `route.json` | Prefix and origin ASN |
| `route_leaks.json` | Evidence of invalid propagation |
| `possible_solutions.json` | Candidate fixes to classify |

## Reasoning Workflow

### Step 1 — Sanity-Check Inputs

- Every ASN referenced must exist in `topology.json`
- Relationship symmetry must hold:
  - `provider(A→B)` ⇔ `customer(B→A)`
  - `peer` must be symmetric

### Step 2 — Detect BGP Oscillation (Preference Cycle)

Build a directed graph `ASN → preferred next-hop ASN`; any cycle implies oscillation. A 2-node cycle is sufficient.

### Step 3 — Detect BGP Route Leak (Valley-Free Violation)

| Learned from | May export to |
|--------------|---------------|
| Customer | Anyone |
| Peer | Customers only |
| Provider | Customers only |

A leak exists if a route learned from a provider or peer is exported to a peer or provider.

## Fix Selection Logic (Ranked)

- **Tier 1 — Virtual WAN Routing Intent** — preferred; operates above BGP.
- **Tier 2 — Export / Route Policy** — filter routes learned from a peer before re-advertising; communities; ingress filtering; RPKI origin validation.
- **Tier 3 — User Defined Routes (UDR)** — authoritative next-hop override.

## Prohibited Fixes

| Proposed Fix | Reason |
|--------------|--------|
| Disable BGP | Not customer-controllable |
| Disable peering | prohibited operation |
| Shutdown gateways | Breaks SLA |
| Restart devices | Resets symptoms only |

## Output Expectations

1. Identify oscillation and/or route leak correctly
2. Explain why it occurs
3. Recommend allowed policy-level fixes
4. Explicitly reject prohibited fixes with reasoning

## References

- RFC 4271 — Border Gateway Protocol 4 (BGP-4)
- Gao–Rexford model — Valley-free routing economics

