Chapter 12 of 12

Book 01 — Azure Networking Deep Dive

Monitoring, Troubleshooting, and Cost

Effective network operations require two things: reactive diagnosis tools to resolve incidents quickly, and proactive monitoring to catch degradation before users notice. Azure provides Network Watcher for diagnostics, NSG flow logs and Traffic Analytics for visibility, and Azure Monitor for alerting on network health metrics.

Azure Network Watcher

Network Watcher is a regional service that must be enabled per subscription per region. It provides both one-shot diagnostic tools and continuous monitoring capabilities.

Network Watcher tools organized as diagnostic one-shot tools (IP Flow Verify, Next Hop, NSG Diagnostics, Connection Troubleshoot, Packet Capture, VPN Diagnostics) and continuous monitoring tools (Connection Monitor, NSG Flow Logs with Traffic Analytics). Common troubleshooting scenarios shown at bottom.
Figure 12.1 — Network Watcher: diagnostic one-shot tools vs continuous monitoring; troubleshooting sequences

IP Flow Verify

Tests whether an NSG would allow or deny a specific 5-tuple flow at a given VM NIC. Returns the matching rule name.

bash
# Does NSG allow TCP 443 inbound to this VM?
az network watcher test-ip-flow \
  --resource-group rg-app --vm vm-web-01 \
  --direction Inbound \
  --local 10.0.1.4:443 \
  --remote 0.0.0.0:60000 \
  --protocol TCP

Next Hop

Shows the effective route (next hop type and IP) for a packet leaving a VM, respecting all UDRs, BGP-learned routes, and system routes.

bash
# What is the next hop for traffic from vm-web-01 to 8.8.8.8?
az network watcher show-next-hop \
  --resource-group rg-app --vm vm-web-01 \
  --source-ip 10.0.1.4 \
  --dest-ip 8.8.8.8
# nextHopType: VirtualAppliance → UDR forcing through Firewall

NSG Flow Logs and Traffic Analytics

NSG flow logs v2 record every flow through an NSG — allowed and denied — as JSON blobs in a Storage Account with byte and packet counts. Traffic Analytics processes these logs and writes enriched records to Log Analytics, enabling KQL-based analysis.

NSG Flow Logs data pipeline from VMs through NSGs to Storage Account. Traffic Analytics processes logs every 10 or 60 minutes and sends enriched data to Log Analytics workspace with AzureNetworkAnalytics_CL table. KQL queries and Workbooks provide top talkers, denied flows, malicious IPs. Bottom panel shows key metric alerts for VPN, ExpressRoute, LB, App Gateway, and Firewall.
Figure 12.2 — Flow logs pipeline: NSG → Storage → Traffic Analytics → Log Analytics; key metric alerts
bash
# Enable NSG flow logs v2 with Traffic Analytics
az network watcher flow-log create \
  --name fl-nsg-app --resource-group rg-app \
  --location eastus2 --nsg nsg-app \
  --storage-account sa-flowlogs \
  --enabled true --format JSON \
  --log-version 2 --retention 7 \
  --workspace ".../law-monitoring" \
  --traffic-analytics true \
  --interval 10

Traffic Analytics KQL Queries

kusto
// Top 10 talkers by bytes
AzureNetworkAnalytics_CL
| where SubType_s == "FlowLog"
| summarize TotalBytes = sum(BytesSent_d + BytesReceived_d) by SrcIP_s
| top 10 by TotalBytes

// Denied flows — investigate blocked traffic
AzureNetworkAnalytics_CL
| where FlowStatus_s == "D"
| project TimeGenerated, SrcIP_s, DestIP_s, DestPort_d, NSGRule_s

Azure Monitor Network Insights

Azure Monitor → Networks provides a unified topology view across all network resources. Key metrics to alert on:

ResourceMetricAlert Condition
VPN GatewayTunnelEgressBytes= 0 for 5 min → tunnel down
VPN GatewayBGPPeerStatus< 1 → BGP session down
ExpressRouteArpAvailability< 100% → path-level issue
Load BalancerDipAvailability< 100% → unhealthy backends
App GatewayHealthyHostCountDrop → backend draining
Azure FirewallFirewallHealth< 100% → degraded
Azure FirewallSNATPortUtilization> 80% → SNAT exhaustion risk

Network Cost Patterns

Cost DriverRate (approx)Mitigation
VNet Peering intra-region$0.01/GB per directionUse vWAN or consolidate spoke-to-spoke flows
VNet Peering cross-region$0.02–$0.05/GBConsider regional hubs
VPN Gateway egressPer-SKU + dataUse ER Unlimited for high-volume workloads
Public IP outbound (internet)Per-GB tieredNAT Gateway pools SNAT — avoids per-VM PIP
Azure FirewallPer-hour + per-GBCentralise in hub; avoid multiple FW per spoke

Tip

In hub-and-spoke topologies, spoke-to-spoke flows traverse two peering links and are charged twice. For workloads with high east-west traffic between spokes, consider co-locating them in the same VNet or evaluating Azure Virtual WAN, which charges a flat hub processing fee rather than double peering.

Common Troubleshooting Scenarios

VM Cannot Reach the Internet

  1. Run az network watcher test-ip-flow — confirm NSG is not denying outbound
  2. Run az network watcher show-next-hop — confirm next hop is Internet (or VirtualAppliance if routed through Firewall)
  3. If through Firewall: check Application/Network rule allows the destination FQDN/IP

VPN Tunnel Connected But No Traffic Passes

  1. Verify BGP route exchange: az network vnet-gateway list-advertised-routes
  2. Confirm on-premises side is advertising the correct prefixes
  3. Check GatewaySubnet — no restrictive NSG should exist on it
  4. IP Flow Verify from a VM in the connected subnet

Private Endpoint Not Resolving to Private IP

  1. Check Private DNS Zone is linked to the VM's VNet
  2. Check privateDnsZoneGroup is configured on the Private Endpoint
  3. Verify A record exists: az network private-dns record-set a list --zone-name privatelink.blob.core.windows.net
  4. Run nslookup from the VM — should see CNAME to privatelink zone, then private IP

Lab: NSG Flow Logs Setup

1

Enable NSG Flow Logs (CE-25)

bash
RG="rg-lab-ch12"; LOC="eastus2"
az group create --name "$RG" --location "$LOC"

SA_NAME="salabflowlogs$RANDOM"
az storage account create \
  --name "$SA_NAME" --resource-group "$RG" \
  --location "$LOC" --sku Standard_LRS

az network nsg create --name nsg-lab \
  --resource-group "$RG" --location "$LOC"

az network watcher configure \
  --resource-group NetworkWatcherRG \
  --locations "$LOC" --enabled true

# Enable flow log (Traffic Analytics requires Log Analytics workspace)
az network watcher flow-log create \
  --name fl-nsg-lab --resource-group "$RG" \
  --location "$LOC" --nsg nsg-lab \
  --storage-account "$SA_NAME" \
  --enabled true --log-version 2 --retention 7

az group delete --name "$RG" --yes --no-wait

Summary

ConceptKey Fact
IP Flow VerifyTests NSG allow/deny for a 5-tuple; returns matched rule name
Next HopShows effective UDR next hop for a packet from a VM NIC
Connection MonitorContinuous synthetic tests; alerts on RTT / packet loss
NSG Flow Logs v2All flows; byte + packet counts; JSON to Storage Account
Traffic AnalyticsEnriches flow logs; top talkers, geo map, malicious IPs in Log Analytics
VNet Flow LogsVNet-scope visibility incl. same-subnet; no NSG required
BGPPeerStatus = 0VPN/ER BGP session down — alert Severity 1
Peering cost$0.01/GB intra-region, charged per direction; spoke-to-spoke = 2x
Troubleshoot orderIP Flow Verify → Next Hop → NSG Diagnostics → Packet Capture
Book 01 Complete — Azure Networking Deep Dive
All 12 chapters have been published. You have covered the complete Azure networking stack from VNet fundamentals through hybrid connectivity, application delivery, security, DNS, and operational monitoring. Use the chapter navigation to revisit any topic or proceed to the lab exercises for hands-on practice with all 25 exercises (CE-01 through CE-25).

Chapter: 12 of 12  |  Status: v0.1 Draft  |