Azure VNet Networking Security Audit
Cloud resource audit for Azure Virtual Network (VNet) architecture,
network security posture, and hybrid connectivity. This skill evaluates
provider-specific Azure networking constructs — VNet design, NSG priority-
based rules, Azure Firewall rule collection groups, ExpressRoute circuits,
VNet Peering topology, UDR forced tunneling, and Application Gateway
placement — not generic cloud networking advice.
Scope covers VNet-layer networking: address space planning, subnet
delegation, NSG filtering, Azure Firewall inspection, hybrid connectivity
via ExpressRoute and VPN Gateway, and route management. Out of scope:
Azure Front Door CDN policies, Azure WAF custom rule authoring,
application-layer routing in Application Gateway path rules, and Azure
DNS zone management. Reference references/cli-reference.md for read-only
Azure CLI commands organized by audit step, and references/vnet-architecture.md
for the VNet packet flow model, NSG evaluation order, and ExpressRoute
routing architecture.
When to Use
- - VNet architecture design review — validating address space allocation, subnet delegation, and service endpoint configuration
- Post-migration networking audit — verifying VNet connectivity, NSG rules, and UDR entries after workload migration
- Security assessment — identifying overly permissive NSG rules, default NSG exposure, and missing Azure Firewall policies
- Connectivity troubleshooting — diagnosing ExpressRoute BGP peering failures, VPN Gateway tunnel drops, or VNet Peering asymmetric routing
- Compliance preparation — documenting VNet segmentation, NSG justification, and Azure Firewall logging for auditors
- Cost optimization review — identifying unused public IPs, orphaned NICs, and underutilized Application Gateway instances
Prerequisites
- - Azure CLI authenticated (
az account show succeeds) - RBAC permissions — Reader role on target subscription, or granular read permissions:
Microsoft.Network/virtualNetworks/read, Microsoft.Network/networkSecurityGroups/read, Microsoft.Network/azureFirewalls/read, Microsoft.Network/expressRouteCircuits/read, Microsoft.Network/virtualNetworkGateways/read, Microsoft.Network/routeTables/read, INLINECODE9 - Target scope identified — specific subscription, resource group(s), and VNet name(s). Multi-subscription audits require
az account set per subscription - Network Watcher enabled — NSG Flow Logs and effective security rules require Network Watcher in the target region. If disabled, document as Critical
Procedure
Follow these six steps sequentially. Each step builds on prior findings,
moving from inventory through security analysis to optimization.
Step 1: VNet Inventory and Design Assessment
Enumerate all VNets in the target subscription and assess architectural design.
CODEBLOCK0
For each VNet, evaluate:
- - Address space allocation: Primary and additional address spaces. Check RFC 1918 compliance, overlapping address spaces across peered VNets (blocks VNet Peering), and sufficient space for growth.
- Subnet layout: Identify subnets by purpose — workload subnets, AzureFirewallSubnet (required name for Azure Firewall), GatewaySubnet (required for VPN Gateway and ExpressRoute Gateway), AzureBastionSubnet. Verify required named subnets exist for deployed services.
- Subnet delegation: Check delegations to Azure services (
Microsoft.Sql/managedInstances, Microsoft.Web/serverFarms). Delegated subnets restrict which resources can deploy — a subnet delegated to SQL Managed Instance cannot host VMs or other services. - Service endpoints vs Private Endpoints: Service endpoints route PaaS traffic over Azure backbone but don't remove public endpoints on the PaaS resource. Private Endpoints create a private IP within the VNet for the PaaS service, removing public exposure entirely. Audit whether data services (Storage, SQL, Key Vault) use Private Endpoints (preferred for zero-trust) or service endpoints (legacy approach with broader exposure).
- DDoS Protection: Verify whether DDoS Protection Standard is enabled on the VNet. Basic DDoS protection is automatic for all Azure resources; Standard adds volumetric attack mitigation, cost protection guarantees, and access to the DDoS Rapid Response team.
Step 2: NSG Rule Audit
Audit Network Security Groups using Azure's priority-based evaluation model.
CODEBLOCK1
NSG rules evaluate by priority (lowest number = highest priority, range 100–4096). First match wins.
- - Priority ordering conflicts: An Allow at priority 200 cannot be overridden by a Deny at 300. Verify Deny rules have lower priority numbers than conflicting Allows — inverse of AWS NACL logic.
- Default NSG rules: Azure creates three default inbound rules (AllowVNetInBound 65000, AllowAzureLoadBalancerInBound 65001, DenyAllInBound 65500) and three outbound defaults (AllowVNetOutBound, AllowInternetOutBound, DenyAllOutBound). These cannot be deleted but are overridden by any custom rule with lower priority number.
- Internet inbound: NSG rules permitting inbound from
* or the Internet service tag. SSH/RDP from Internet is Critical; HTTPS on an Application Gateway subnet may be acceptable. The Internet service tag covers all public IP space excluding VNet, peered VNet, and on-premises address ranges. - Effective security rules: NSGs apply at both subnet and NIC level. Azure evaluates subnet NSG first (inbound), then NIC NSG — traffic must pass both. Use
az network nic show-effective-nsg to see the combined effective rules with resolved priorities. A rule allowed by subnet NSG but denied by NIC NSG is effectively denied. - Application Security Groups (ASGs): ASGs group NICs for use as source/destination in NSG rules instead of IP ranges. Audit ASG membership for correctness.
- Unused NSGs: NSGs not associated with any subnet or NIC are cleanup candidates.
Step 3: Azure Firewall and Network Security
Evaluate Azure Firewall policies, rule collection groups, and threat intelligence.
CODEBLOCK2
- - Rule collection group priority: Azure Firewall processes rule collection groups by priority (lowest first). DNAT rules process first, then Network rules, then Application rules.
- DNAT rules: Translate inbound traffic to private IPs. Verify each DNAT rule maps to a valid backend. Stale DNAT rules pointing to decommissioned hosts create exposure.
- Network rules: Permit/deny by IP, port, protocol. Audit for overly broad rules (
* source/destination, wide port ranges). - Application rules: Filter outbound by FQDN/URL. Verify application rules enforce FQDN restrictions for workload internet access.
- Threat intelligence mode: Azure Firewall supports threat intelligence filtering in Alert or Deny mode. Verify production firewalls use Deny mode.
- IDPS: Azure Firewall Premium supports signature-based IDPS. Verify mode (Alert vs Alert and Deny) and that bypass rules are justified.
- Azure Firewall subnet: AzureFirewallSubnet must be /26 or larger with a public IP and UDRs routing traffic through it.
Step 4: Connectivity Analysis
Evaluate hybrid and inter-VNet connectivity through ExpressRoute, VPN Gateway, and VNet Peering.
ExpressRoute:
CODEBLOCK3
- - Circuit status: Verify ExpressRoute circuit shows "Provisioned" (provider side) and "Enabled" (Azure side). "NotProvisioned" means the provider has not completed circuit setup — no traffic will flow.
- BGP peering state: Check Azure Private Peering and Microsoft Peering BGP session state. State should be "Connected" — "Idle" or "Active" without "Connected" indicates peering negotiation failure (ASN mismatch, VLAN ID mismatch, or provider issue).
- Advertised routes: Verify on-premises routes are visible in Azure via
az network express-route list-route-tables and Azure VNet routes are advertised back to on-premises. Missing routes cause silent traffic drops.
VPN Gateway:
CODEBLOCK4
- - Connection status: Should show "Connected". "Connecting" indicates IKE/IPsec parameter mismatch.
- Gateway SKU: Basic SKU lacks BGP and zone-redundancy. VpnGw2+ recommended for production.
VNet Peering:
CODEBLOCK5
- - Peering state: Both sides must show "Connected". "Initiated" means reciprocal peering missing.
- Transit settings:
AllowGatewayTransit on hub and UseRemoteGateways on spoke enable shared ExpressRoute/VPN. Verify settings match hub-spoke intent. - Address space overlap: VNet Peering requires non-overlapping address spaces. Compare both VNets.
- Forwarded traffic:
AllowForwardedTraffic must be enabled on both peering links for transit routing through Azure Firewall in the hub.
Step 5: UDR and Routing Validation
Audit User-Defined Routes for correctness, forced tunneling, and conflicts.
CODEBLOCK6
- - Forced tunneling: UDRs with
0.0.0.0/0 next-hop to Azure Firewall or NVA force internet traffic through inspection. Verify forced tunneling is NOT applied to AzureFirewallSubnet, GatewaySubnet, or AzureBastionSubnet. - Asymmetric routing: Inbound via ExpressRoute but return via Azure Firewall UDR causes asymmetry. Verify UDR next-hop addresses match expected traffic paths in both directions.
- Effective routes per NIC: Azure resolves UDR > BGP > system routes. Use
az network nic show-effective-route-table for final effective routes. - BGP route propagation: UDR tables can disable BGP propagation (
disableBgpRoutePropagation). When disabled, ExpressRoute/VPN routes are not injected. Verify this matches routing design. - Next-hop validation: UDR routes to virtual appliance IPs must reference running, healthy NVAs or Azure Firewall. A stopped VM next-hop creates a silent black hole.
Step 6: Report and Optimization
Compile findings and identify resource optimization opportunities.
CODEBLOCK7
- - Orphaned NICs: NICs not attached to a VM — common after deletions. Each may have NSG rules and private IPs consuming address space.
- Unassociated public IPs: Standard SKU public IPs incur charges when unassociated. Release or associate.
- Application Gateway optimization: Application Gateway v2 runs continuously. Verify autoscale min/max matches traffic patterns.
- Azure Advisor recommendations: Check
az advisor recommendation list --category Cost for networking optimization opportunities.
Compile the findings report using the Report Template section.
Threshold Tables
NSG Rule Severity
| Finding | Severity | Rationale |
|---|
| NSG allows SSH (22) from Internet | Critical | Direct shell access from internet |
| NSG allows RDP (3389) from Internet |
Critical | Remote desktop open to internet |
| NSG allows all ports from * source | Critical | No port or source restriction |
| NIC with no NSG, subnet NSG allows broad access | High | No NIC-level filtering |
| Allow rule at lower priority than conflicting Deny | High | Priority ordering undermines deny intent |
| NSG allows database ports from non-app subnets | High | Database access not restricted to app tier |
| NSG with >50 custom rules | Medium | Excessive complexity |
| NSG not associated with any subnet or NIC | Medium | Unused — cleanup candidate |
ExpressRoute Circuit Health
| Metric | Severity | Action |
|---|
| Circuit status NotProvisioned | Critical | No connectivity — engage provider |
| BGP peering state Idle |
High | Negotiation failure — check ASN and VLAN |
| Learned routes missing expected prefixes | High | On-prem routes not advertised |
| Circuit utilization >80% sustained | Medium | Plan upgrade or second circuit |
Subnet Utilization
| Available IPs (% of address space) | Severity | Action |
|---|
| <10% remaining | High | Exhaustion risk — plan expansion |
| 10–25% remaining |
Medium | Monitor growth proactively |
| >75% unused | Low | Over-provisioned |
Decision Trees
Is This NSG Rule Overly Permissive?
CODEBLOCK8
Is This VNet Design Following Azure Best Practices?
CODEBLOCK9
Report Template
CODEBLOCK10
Troubleshooting
NSG Flow Logs Not Enabled
If Network Watcher NSG Flow Logs are not configured, traffic visibility is
limited to NSG hit counts. NSG Flow Logs require Network Watcher enabled
and a storage account. Version 2 includes throughput data. Document
missing Flow Logs as High.
Effective Security Rules Show Unexpected Allows
Use az network nic show-effective-nsg for combined subnet and NIC NSG
rules. Check for: higher-priority Allow in NIC NSG overriding subnet Deny,
default rules (65000+) permitting VNet-to-VNet traffic, or ASG membership
including unintended NICs.
ExpressRoute BGP Session Not Established
Verify VLAN ID matches between Azure and provider. Check BGP ASN matches
on-premises router. Use az network express-route peering show to compare
settings. Both primary and secondary should show "Connected".
VNet Peering Shows Initiated But Not Connected
Both peering links must be created. "Initiated" means only one side is
configured. Create the reciprocal link. Cross-subscription peering requires
RBAC on both subscriptions.
UDR Causing Asymmetric Routing
When ExpressRoute delivers inbound traffic directly but UDR routes return
traffic through Azure Firewall, asymmetric routing occurs — the firewall
drops return packets with no session state. Ensure UDR routes both
directions through the firewall, or configure Azure Firewall SNAT.
Azure VNet 网络安全审计
针对 Azure 虚拟网络(VNet)架构、网络安全态势和混合连接的云资源审计。此技能评估特定于提供商的 Azure 网络结构——VNet 设计、基于优先级的 NSG 规则、Azure 防火墙规则收集组、ExpressRoute 线路、VNet 对等拓扑、UDR 强制隧道和应用程序网关放置——而非通用云网络建议。
范围涵盖 VNet 层网络:地址空间规划、子网委派、NSG 过滤、Azure 防火墙检查、通过 ExpressRoute 和 VPN 网关的混合连接以及路由管理。范围外:Azure Front Door CDN 策略、Azure WAF 自定义规则编写、应用程序网关路径规则中的应用层路由以及 Azure DNS 区域管理。参考 references/cli-reference.md 获取按审计步骤组织的只读 Azure CLI 命令,参考 references/vnet-architecture.md 获取 VNet 数据包流模型、NSG 评估顺序和 ExpressRoute 路由架构。
使用时机
- - VNet 架构设计审查——验证地址空间分配、子网委派和服务终结点配置
- 迁移后网络审计——验证工作负载迁移后的 VNet 连接、NSG 规则和 UDR 条目
- 安全评估——识别过于宽松的 NSG 规则、默认 NSG 暴露和缺失的 Azure 防火墙策略
- 连接故障排除——诊断 ExpressRoute BGP 对等故障、VPN 网关隧道断开或 VNet 对等非对称路由
- 合规准备——为审计人员记录 VNet 分段、NSG 理由和 Azure 防火墙日志
- 成本优化审查——识别未使用的公共 IP、孤立 NIC 和未充分利用的应用程序网关实例
前提条件
- - Azure CLI 已认证(az account show 成功)
- RBAC 权限——目标订阅上的读者角色,或细粒度读取权限:Microsoft.Network/virtualNetworks/read、Microsoft.Network/networkSecurityGroups/read、Microsoft.Network/azureFirewalls/read、Microsoft.Network/expressRouteCircuits/read、Microsoft.Network/virtualNetworkGateways/read、Microsoft.Network/routeTables/read、Microsoft.Network/networkInterfaces/read
- 已确定目标范围——特定订阅、资源组和 VNet 名称。多订阅审计需要每个订阅执行 az account set
- 已启用网络观察程序——NSG 流日志和有效安全规则需要在目标区域启用网络观察程序。如果禁用,记录为严重
操作步骤
按顺序执行以下六个步骤。每个步骤基于之前的发现,从清单收集到安全分析再到优化。
步骤 1:VNet 清单和设计评估
枚举目标订阅中的所有 VNet 并评估架构设计。
az network vnet list --output table
az network vnet show --name --resource-group
az network vnet subnet list --vnet-name --resource-group
对于每个 VNet,评估:
- - 地址空间分配: 主要和附加地址空间。检查 RFC 1918 合规性、对等 VNet 之间的地址空间重叠(阻止 VNet 对等)以及足够的增长空间。
- 子网布局: 按用途识别子网——工作负载子网、AzureFirewallSubnet(Azure 防火墙的必需名称)、GatewaySubnet(VPN 网关和 ExpressRoute 网关必需)、AzureBastionSubnet。验证已部署服务存在必需的命名子网。
- 子网委派: 检查对 Azure 服务的委派(Microsoft.Sql/managedInstances、Microsoft.Web/serverFarms)。委派的子网限制可部署的资源——委派给 SQL 托管实例的子网无法托管 VM 或其他服务。
- 服务终结点 vs 专用终结点: 服务终结点通过 Azure 主干路由 PaaS 流量,但不会移除 PaaS 资源上的公共终结点。专用终结点在 VNet 内为 PaaS 服务创建私有 IP,完全消除公共暴露。审计数据服务(存储、SQL、Key Vault)是使用专用终结点(零信任首选)还是服务终结点(暴露范围更广的传统方法)。
- DDoS 防护: 验证 VNet 上是否启用了 DDoS 防护标准版。基本 DDoS 防护对所有 Azure 资源自动启用;标准版增加了大规模攻击缓解、成本保护保证和 DDoS 快速响应团队的访问权限。
步骤 2:NSG 规则审计
使用 Azure 基于优先级的评估模型审计网络安全组。
az network nsg list --output table
az network nsg rule list --nsg-name --resource-group --include-default --output table
NSG 规则按优先级评估(数字越小优先级越高,范围 100–4096)。最先匹配的规则生效。
- - 优先级排序冲突: 优先级 200 的允许规则不能被优先级 300 的拒绝规则覆盖。验证拒绝规则的优先级数字低于冲突的允许规则——与 AWS NACL 逻辑相反。
- 默认 NSG 规则: Azure 创建三条默认入站规则(AllowVNetInBound 65000、AllowAzureLoadBalancerInBound 65001、DenyAllInBound 65500)和三条出站默认规则(AllowVNetOutBound、AllowInternetOutBound、DenyAllOutBound)。这些规则无法删除,但会被任何优先级数字更小的自定义规则覆盖。
- 互联网入站: 允许从 * 或 Internet 服务标签入站的 NSG 规则。来自互联网的 SSH/RDP 为严重;应用程序网关子网上的 HTTPS 可能可接受。Internet 服务标签涵盖除 VNet、对等 VNet 和本地地址范围之外的所有公共 IP 空间。
- 有效安全规则: NSG 同时应用于子网和 NIC 级别。Azure 先评估子网 NSG(入站),然后评估 NIC NSG——流量必须通过两者。使用 az network nic show-effective-nsg 查看具有已解析优先级的组合有效规则。子网 NSG 允许但 NIC NSG 拒绝的规则实际上被拒绝。
- 应用程序安全组(ASG): ASG 将 NIC 分组,用作 NSG 规则中的源/目标,而非 IP 范围。审计 ASG 成员资格的正确性。
- 未使用的 NSG: 未关联到任何子网或 NIC 的 NSG 是清理候选对象。
步骤 3:Azure 防火墙和网络安全
评估 Azure 防火墙策略、规则收集组和威胁情报。
az network firewall list --output table
az network firewall policy rule-collection-group list --policy-name --resource-group
- - 规则收集组优先级: Azure 防火墙按优先级处理规则收集组(最低优先)。DNAT 规则先处理,然后是网络规则,最后是应用程序规则。
- DNAT 规则: 将入站流量转换为私有 IP。验证每个 DNAT 规则映射到有效的后端。指向已停用主机的陈旧 DNAT 规则会造成暴露。
- 网络规则: 按 IP、端口、协议允许/拒绝。审计过于宽泛的规则(* 源/目标、宽端口范围)。
- 应用程序规则: 按 FQDN/URL 过滤出站流量。验证应用程序规则对工作负载互联网访问强制执行 FQDN 限制。
- 威胁情报模式: Azure 防火墙支持告警或拒绝模式的威胁情报过滤。验证生产防火墙使用拒绝模式。
- IDPS: Azure 防火墙高级版支持基于签名的 IDPS。验证模式(告警 vs 告警并拒绝)以及绕过规则是否合理。
- Azure 防火墙子网: AzureFirewallSubnet 必须为 /26 或更大,具有公共 IP 和通过其路由流量的 UDR。
步骤 4:连接分析
通过 ExpressRoute、VPN 网关和 VNet 对等评估混合和 VNet 间连接。
ExpressRoute:
az network express-route show --name --resource-group
az network express-route peering list --circuit-name --resource-group
- - 线路状态: 验证 ExpressRoute 线路显示已预配(提供商侧)和已启用(Azure 侧)。未预配表示提供商尚未完成线路设置——不会产生流量。
- BGP 对等状态: 检查 Azure 私有对等和 Microsoft 对等 BGP 会话状态。状态应为已连接——空闲或活动而未已连接表示对等协商失败(ASN 不匹配、VLAN ID 不匹配或提供商问题)。
- 播发路由: 通过 az network express-route list-route-tables 验证本地路由在 Azure 中可见,并且 Azure VNet 路由播发回本地。缺失的路由会导致静默流量丢弃。
VPN 网关:
az network vpn-connection