13 — Pièges & Commandes (AZ-700)
À relire avant l'exam : les pièges les plus fréquents + les commandes clés.
PARTIE 1 — Pièges récurrents (par thème)
VNet / IP / Subnets
- 🚨 5 IPs réservées par subnet →
/29= 8 IPs mais 3 utilisables ;/24= 251 utilisables. - 🚨 Subnets nommés (casse exacte, rien d'autre dedans) :
GatewaySubnet,AzureBastionSubnet,AzureFirewallSubnet,RouteServerSubnet. - 🚨 Pas d'overlap d'IP entre VNets peerés, on-prem, ou hub vWAN.
- VNet/subnets s'étendent sur toutes les AZ de la région (un subnet n'est pas zonal).
- 🚨 Basic Public IP + Basic LB retirés 30 sept 2025. Standard Public IP = Static obligatoire.
- 🚨 SKU matching : Public IP Standard ↔ LB Standard ↔ NAT GW ↔ VPN/FW GW. Mismatch → upgrade la Public IP.
- 🚨 NAT GW + ressources Basic SKU dans le subnet = KO → migrer en Standard. NAT GW passe avant la Public IP de la VM (priorité outbound).
Routing / UDR / BGP
- 🚨 Précédence : UDR > BGP > System routes, puis route la plus spécifique gagne.
- 🚨 Exception : routes système VNet local, peering, Service Endpoints = preferred → non overridables par BGP ni UDR.
- 🚨 NVA = IP forwarding activé sur sa NIC sinon paquets droppés.
- 🚨 Route table associée au SUBNET (pas VNet, pas NIC).
- 🚨 Azure Route Server : ASN fixe
65515(non modifiable), BGP only.
Peering
- 🚨 NON transitif : A↔B + B↔C ≠ A↔C → hub-spoke avec NVA, ou vWAN pour transitivité native.
- 🚨 Bilatéral : configurer les 2 côtés (A→B ET B→A).
- 🚨 Gateway Transit ↔ Use Remote Gateways = couple miroir : hub coche Allow gateway transit, spoke coche Use remote gateways. Oublier un = KO.
- Spoke = 1 seul remote gateway max. Allow Forwarded Traffic requis quand un NVA relaie entre spokes.
DNS / Private Resolver
- 🚨 Private DNS Zone : 1 seul VNet en auto-registration par zone (les autres = resolution only).
- 🚨 Private Endpoint sans zone
privatelink.*→ le FQDN résout l'IP publique → toujours intégrer la Private DNS Zone. - 🚨 Custom DNS sur le VNet = perte d'Azure DNS + Private DNS Zones, sauf forward vers
168.63.129.16. - 🚨 Conditional forwarders PAS supportés dans les VNets → côté Azure = DNS Forwarding Ruleset (Private Resolver).
- 🚨 Private Resolver n'a PAS de connectivité propre : doit être dans un VNet déjà relié on-prem. Subnets délégués
Microsoft.Network/dnsResolvers,/28min.
Firewall
- 🚨 Ordre d'évaluation : Threat Intel → DNAT → Network → Application → une App "Allow" n'override PAS une Network "Deny".
- 🚨 Default action = Deny (rien ne match → bloqué).
- 🚨 Parent/child policy : le parent gagne TOUJOURS quelle que soit la priorité du child. SKU parent ↔ child identique obligatoire.
- 🚨 DNS Proxy requis pour FQDN dans les Network rules (pas requis pour App rules).
- 🚨 TLS inspection, IDPS, URL filtering = Premium uniquement.
- 🚨
AzureFirewallSubnet/26, pas de NSG/UDR. Forced tunneling → 2e subnetAzureFirewallManagementSubnet/26.
VPN S2S / P2S
- 🚨 Policy-based vs route-based figé à la création → erreur = delete + recreate. Route-based = défaut (BGP, active-active, P2S). Policy-based = 1 tunnel IKEv1, pas de P2S.
- 🚨 Basic SKU = pas de BGP/AZ/OpenVPN/active-active/transit.
- 🚨 PSK + custom IPsec policy identiques des 2 côtés sinon tunnel down.
- 🚨 BGP n'auto-découvre PAS l'IP publique on-prem → la déclarer dans le Local Network Gateway. ASN Azure
65515, peer IP dansGatewaySubnetou APIPA169.254.21.0–22.255. - 🚨 Active-active : route-based + non-Basic + 2 Public IPs + 2 tunnels.
- 🚨 Entra ID auth = OpenVPN uniquement. Cert auth = exporter QUE la clé publique root (
.cer). RADIUS server = IP privée. - 🚨 Always-On Device Tunnel = Cert auth obligatoire.
GatewaySubnet/27min (/25si coexistence ER + VPN).
ExpressRoute
- 🚨 Local SKU = 1 région ; Premium requis pour Global Reach cross-geopolitical + plus de routes/VNets.
- 🚨 Global Reach = range
/29obligatoire (connecte 2 circuits ER on-prem ↔ on-prem). - 🚨 Service Key ≠ Authorization Key : Service Key = ID du circuit pour le provider ; Auth Key = connecter un VNet cross-subscription.
- 🚨 Microsoft peering sans Route Filter → flood BGP. ER ne chiffre pas (IPsec over ER, ou MACsec = ER Direct only).
- 🚨 FastPath : SKU min ErGw3AZ/UltraPerformance. + UDR = ER Direct only, pas cross-region.
- 🚨 Bandwidth circuit < somme des GW → circuit = bottleneck. BFD activé des 2 côtés.
Virtual WAN
- 🚨 Basic SKU = S2S only (pas hub-to-hub/ER/P2S/NVA). Upgrade Basic→Standard = irréversible.
- 🚨 Hub address space ne doit pas overlap (spokes, on-prem).
- 🚨 Routing Intent exclut les custom route tables → supprimer les custom routes avant activation. Max 1 Internet + 1 Private policy par hub.
- 🚨 Propagate ≠ Associate : Associate = quelle route table la connexion utilise ; Propagate = vers quelles tables ses routes sont annoncées.
- 🚨 Suppression vWAN = ordre strict : connexions → NVA → routing intent → gateways → hubs → vWAN.
Load Balancer
- 🚨 LB = L4 only : pas de SSL termination / WAF / path routing → App Gateway ou Front Door.
- 🚨 Standard LB bloque l'outbound par défaut → outbound rule OU NAT Gateway (NAT GW recommandé en prod).
- 🚨 Inbound NAT rule ≠ LB rule : NAT = vers 1 VM précise ; LB rule = tout le pool.
- 🚨 HA Ports = Standard + Internal LB uniquement (pas Public LB).
- 🚨 Cross-Region LB (Global) ≠ Traffic Manager : LB global = proxy L4 (failover instant), backend = LB régionaux ; TM = DNS (failover lent).
Application Gateway
- 🚨 v1 retiré 28 avril 2026 → v2 (Standard_v2 / WAF_v2). AGW = régional (multi-region → Front Door devant).
- 🚨 Subnet dédié vide (
/24reco v2). Ne pas bloquer les ports de management v2 65200-65535 (Service TagGatewayManager). - 🚨 Pick host name from backend = Yes pour un App Service backend, sinon 404.
- 🚨 Custom probe : matcher
200-399(gère les redirects). Public IP Standard obligatoire. - 🚨 SSL offload = front HTTPS / back HTTP ; end-to-end = re-chiffré (besoin root cert backend).
Front Door / Traffic Manager
- 🚨 Front Door = HTTP/S only. TCP/UDP global → Cross-Region LB. FD Classic retiré 31 mars 2027.
- 🚨 Managed rules (DRS) + Bot Manager + Private Link = Premium only (Standard = custom rules only).
- 🚨 1 WAF policy = 1 type de service (FD OU AGW, pas réutilisable). WAF : démarrer Detection puis Prevention après tuning.
- 🚨 End-to-end HTTPS FD : "HTTPS only" sur la route = côté client → mettre aussi l'origin en HTTPS.
- 🚨 Anycast partagée : backend doit autoriser Service Tag
AzureFrontDoor.Backend+ filtrer headerX-Azure-FDID. - 🚨 Traffic Manager = DNS only : pas de SSL/WAF/CDN. Endpoint Default obligatoire sinon NXDOMAIN.
Monitoring
- 🚨 Network Watcher = 1 ressource par région (auto avec le 1er VNet).
- 🚨 Connection Monitor = continu + hybride (Arc) vs Connection Troubleshoot = ponctuel.
- 🚨 NSG Flow Logs DÉPRÉCIÉ (stop juin 2025, retraite sept 2027) → VNet Flow Logs. Traffic Analytics → Log Analytics Workspace.
- 🚨 DDoS = L3/L4 volumétrique ; L7 (HTTP flood) = WAF rate limiting. DDoS protège les IPs publiques, pas privées.
- 🚨 DDoS Network Protection = par VNet (+ extras) vs IP Protection = par IP (Public IP Standard only).
Confusions classiques
Service Endpoint vs Private Endpoint
| Service Endpoint | Private Endpoint | |
|---|---|---|
| Niveau | Subnet | Ressource |
| IP privée dans VNet | ❌ | ✅ |
| Accès depuis on-prem | ❌ | ✅ (VPN/ER) |
| DNS | route optimisée | nécessite privatelink.* |
- 🚨 Service Endpoint Policy (SEP) : filtre le SE,
Microsoft.Storageonly, allow-policy. PLS = côté producer, PE = côté consumer (cross-tenant = approbation manuelle).
Front Door vs Traffic Manager vs Cross-Region LB
| Front Door | Traffic Manager | Cross-Region LB | |
|---|---|---|---|
| Couche | L7 (HTTP/S) | DNS | L4 (TCP/UDP) |
| Type | Reverse proxy + CDN + WAF | Résolution DNS | Proxy global |
| Failover | rapide | lent (TTL DNS) | quasi instant |
Network rule vs Application rule (Firewall) : Network = L3/L4 (IP, port, FQDN si DNS Proxy), évaluée avant ; Application = L7 (FQDN HTTP/S, URL, Web Categories).
Dates de retraite à connaître
| Feature | Date |
|---|---|
| Basic Public IP / Basic LB | 30 sept 2025 (retiré) |
| VpnGw1-5 (non-AZ) | création bloquée 1 nov 2025 → SKU AZ |
| App Gateway v1 | 28 avril 2026 |
| SSTP (P2S) | activer impossible 31 mars 2026, suspendu 31 mars 2027 |
| VPN GW Standard / High Perf | 30 juin 2026 (→ VpnGw1AZ/2AZ) |
| Front Door / Traffic Manager Classic | 31 mars 2027 |
| NSG Flow Logs | stop juin 2025, retraite sept 2027 → VNet Flow Logs |
PARTIE 2 — Commandes essentielles (CLI az + PowerShell Az)
VNet / Subnet
az network vnet create -g rg -n vnet --address-prefix 10.0.0.0/16 \
--subnet-name web --subnet-prefix 10.0.1.0/24
az network vnet subnet create -g rg --vnet-name vnet -n app --address-prefix 10.0.2.0/24
# Subnet délégué (ex: DNS Private Resolver)
az network vnet subnet create -g rg --vnet-name vnet -n dnsout \
--address-prefix 10.0.3.0/28 --delegations Microsoft.Network/dnsResolvers
$web = New-AzVirtualNetworkSubnetConfig -Name web -AddressPrefix 10.0.1.0/24
New-AzVirtualNetwork -ResourceGroupName rg -Name vnet -Location eastus -AddressPrefix 10.0.0.0/16 -Subnet $web
NSG / ASG
az network nsg create -g rg -n nsg
az network nsg rule create -g rg --nsg-name nsg -n AllowHTTPS --priority 100 \
--access Allow --protocol Tcp --direction Inbound \
--source-address-prefixes Internet --destination-port-ranges 443
az network vnet subnet update -g rg --vnet-name vnet -n web --network-security-group nsg
# ASG référencé dans une règle
az network asg create -g rg -n web-asg
az network nsg rule create -g rg --nsg-name nsg -n AllowWeb --priority 110 \
--access Allow --protocol Tcp --destination-asgs web-asg --destination-port-ranges 443
Route Table / UDR
az network route-table create -g rg -n rt
az network route-table route create -g rg --route-table-name rt -n to-nva \
--address-prefix 0.0.0.0/0 --next-hop-type VirtualAppliance --next-hop-ip-address 10.0.0.4
az network vnet subnet update -g rg --vnet-name vnet -n app --route-table rt
az network nic update -g rg -n nva-nic --ip-forwarding true # IP forwarding NVA
Private Endpoint / Private DNS Zone
az network private-dns zone create -g rg -n privatelink.blob.core.windows.net
az network private-dns link vnet create -g rg -n blob-link \
-z privatelink.blob.core.windows.net -v vnet --registration-enabled false
az network private-endpoint create -g rg -n pe-blob --vnet-name vnet --subnet web \
--private-connection-resource-id <storage-id> --group-id blob --connection-name blobconn
# Lie le PE à la zone → auto-création du A record
az network private-endpoint dns-zone-group create -g rg --endpoint-name pe-blob \
-n default --private-dns-zone privatelink.blob.core.windows.net --zone-name blob
DNS Private Resolver
az dns-resolver create -g rg -n resolver -l eastus --id <vnet-id>
az dns-resolver inbound-endpoint create -g rg --resolver-name resolver -n in -l eastus \
--ip-configurations '[{"private-ip-allocation-method":"Dynamic","id":"<in-subnet-id>"}]'
az dns-resolver outbound-endpoint create -g rg --resolver-name resolver -n out -l eastus --id <out-subnet-id>
az dns-resolver forwarding-ruleset create -g rg -n ruleset -l eastus \
--outbound-endpoints '[{"id":"<out-endpoint-id>"}]'
VPN Gateway (S2S / P2S) + LNG + Connection
az network vnet subnet create -g rg --vnet-name vnet -n GatewaySubnet --address-prefix 10.0.255.0/27
az network public-ip create -g rg -n vpngw-pip --sku Standard --allocation-method Static
# Route-based, active-active zone-redundant
az network vnet-gateway create -g rg -n vpngw --vnet vnet \
--public-ip-addresses vpngw-pip1 vpngw-pip2 --gateway-type Vpn --vpn-type RouteBased \
--sku VpnGw2AZ --vpn-gateway-generation Generation2 --no-wait
# Local Network Gateway (IP publique on-prem à déclarer)
az network local-gateway create -g rg -n onprem-lng \
--gateway-ip-address 203.0.113.10 --local-address-prefixes 192.168.0.0/16
az network vpn-connection create -g rg -n s2s-conn \
--vnet-gateway1 vpngw --local-gateway2 onprem-lng --shared-key "MyPSK123"
# P2S (route-based requis)
az network vnet-gateway update -g rg -n vpngw --address-prefixes 172.16.0.0/24 --client-protocol OpenVPN
# Re-générer le profil client après tout changement de topologie
az network vnet-gateway vpn-client generate -g rg -n vpngw --processor-architecture Amd64
New-AzVirtualNetworkGatewayConnection -ResourceGroupName rg -Name s2s-conn -Location eastus `
-VirtualNetworkGateway1 $gw -LocalNetworkGateway2 $lng -ConnectionType IPsec -SharedKey "MyPSK123"
ExpressRoute (circuit / peering / gateway / connection / Global Reach)
az network express-route create -g rg -n ckt -l eastus --provider Equinix \
--peering-location "Washington DC" --bandwidth 200 --sku-tier Standard --sku-family MeteredData
az network express-route peering create --circuit-name ckt -g rg \
--peering-type AzurePrivatePeering --peer-asn 65001 --vlan-id 100 \
--primary-peer-subnet 10.0.0.0/30 --secondary-peer-subnet 10.0.0.4/30
az network vnet-gateway create -g rg -n ergw --gateway-type ExpressRoute \
--sku ErGw1AZ --public-ip-addresses ergw-pip --vnet vnet --no-wait
az network vpn-connection create -g rg -n er-conn --vnet-gateway1 ergw --express-route-circuit2 ckt
az network express-route auth create -g rg --circuit-name ckt -n myauth # cross-subscription
# Global Reach (/29 obligatoire)
Add-AzExpressRouteCircuitConnectionConfig -Name GR -ExpressRouteCircuit $ckt1 `
-PeerExpressRouteCircuitPeering $ckt2.Peerings[0].Id -AddressPrefix '10.0.0.0/29'
Set-AzExpressRouteCircuit -ExpressRouteCircuit $ckt1
Virtual WAN (hub, connexions)
az network vwan create -g rg -n vwan --type Standard
az network vhub create -g rg -n hub1 --vwan vwan --address-prefix 10.1.0.0/24 -l eastus
az network vhub connection create -g rg --vhub-name hub1 -n spoke1-conn --remote-vnet <spoke-id>
az network vpn-gateway create -g rg -n hub1-vpngw --vhub hub1 -l eastus --scale-unit 2
Azure Firewall + Policy
az network firewall policy create -g rg -n pol -l eastus --sku Standard
az network firewall policy rule-collection-group create -g rg --policy-name pol -n net-rcg --priority 200
az network firewall policy rule-collection-group collection add-filter-collection \
-g rg --policy-name pol --rule-collection-group-name net-rcg \
--name allow-dns --collection-priority 210 --action Allow \
--rule-name dns --rule-type NetworkRule --protocols UDP \
--source-addresses 10.0.0.0/16 --destination-addresses '*' --destination-ports 53
az network firewall create -g rg -n fw -l eastus --sku AZFW_VNet --tier Standard --firewall-policy pol
az network firewall ip-config create -g rg -f fw -n cfg --public-ip-address fw-pip --vnet-name vnet
Load Balancer
az network lb create -g rg -n lb --sku Standard --public-ip-address lb-pip \
--frontend-ip-name fe --backend-pool-name bepool
az network lb probe create -g rg --lb-name lb -n health --protocol Tcp --port 80
az network lb rule create -g rg --lb-name lb -n http-rule --protocol Tcp \
--frontend-port 80 --backend-port 80 --frontend-ip-name fe --backend-pool-name bepool --probe-name health
# Outbound rule (sinon outbound bloqué)
az network lb outbound-rule create -g rg --lb-name lb -n outbound \
--frontend-ip-configs fe --protocol All --address-pool bepool
Application Gateway
az network application-gateway create -g rg -n agw -l eastus --sku Standard_v2 --capacity 2 \
--vnet-name vnet --subnet agw-subnet --public-ip-address agw-pip --frontend-port 80 \
--servers 10.0.2.4 10.0.2.5 --http-settings-protocol Http --http-settings-port 80
# Probe custom (match 200-399)
az network application-gateway probe create -g rg --gateway-name agw -n probe1 \
--protocol Http --host-name-from-http-settings true --path / --match-status-codes 200-399
Front Door (Standard/Premium)
az afd profile create -g rg --profile-name fd --sku Premium_AzureFrontDoor
az afd endpoint create -g rg --profile-name fd --endpoint-name ep --enabled-state Enabled
az afd origin-group create -g rg --profile-name fd --origin-group-name og1 \
--probe-request-type GET --probe-protocol Https --probe-interval-in-seconds 60 \
--sample-size 4 --successful-samples-required 3 --additional-latency-in-milliseconds 50
az afd origin create -g rg --profile-name fd --origin-group-name og1 --origin-name o1 \
--host-name app.contoso.com --origin-host-header app.contoso.com --https-port 443 --enabled-state Enabled
az afd route create -g rg --profile-name fd --endpoint-name ep --route-name r1 \
--origin-group og1 --supported-protocols Https --forwarding-protocol HttpsOnly --https-redirect Enabled
Traffic Manager
az network traffic-manager profile create -g rg -n tm --routing-method Performance \
--unique-dns-name tm-app --ttl 30 --protocol HTTP --port 80 --path "/health"
az network traffic-manager endpoint create -g rg --profile-name tm -n ep-eastus \
--type azureEndpoints --target-resource-id <pip-id> --endpoint-status Enabled
Network Watcher
# IP Flow Verify — un NSG bloque-t-il ce flux ?
az network watcher test-ip-flow -g rg --vm vm --direction Inbound \
--protocol TCP --local 10.0.1.4:443 --remote 203.0.113.5:60000
# Next Hop — debug UDR
az network watcher show-next-hop -g rg --vm vm --source-ip 10.0.1.4 --dest-ip 8.8.8.8
# VNet Flow Logs (remplace NSG Flow Logs)
az network watcher flow-log create -g rg -n fl -l eastus --vnet vnet \
--storage-account sa --enabled true --traffic-analytics true --workspace <law-id> --interval 10
# Packet Capture (agent + storage)
az network watcher packet-capture create -g rg --vm vm -n cap --storage-account sa
PARTIE 3 — Quick wins (mémorisation)
Tailles de subnets dédiés (min)
| Subnet | Usage | Min |
|---|---|---|
GatewaySubnet |
VPN/ER Gateway | /27 (/25 si ER+VPN) |
AzureFirewallSubnet (+ Management) |
Firewall (+ forced tunnel) | /26 |
AzureBastionSubnet |
Bastion | /26 |
RouteServerSubnet |
Route Server | /27 |
| DNS Private Resolver | Microsoft.Network/dnsResolvers |
/28 |
| Application Gateway | subnet dédié vide | /24 reco v2 |
ASN, IPs & ports à connaître
- ASN Azure (VPN/ER/Route Server) :
65515. - APIPA BGP peer :
169.254.21.0–169.254.22.255. - Azure DNS / wireserver :
168.63.129.16(résolution + health probe LB → ne pas bloquer). - Audience app Azure VPN (Entra auth) :
c632b3df-fb67-4d84-bdcf-b95ad541b5c8. - Global Reach range :
/29(IPv4). - Ports management : AGW v2
65200-65535(GatewayManager), Bastion viaAllowAzureLoadBalancerInBound.
Réflexes troubleshooting
- Flux bloqué ? → IP Flow Verify (NSG).
- Trafic mal routé ? → Next Hop (UDR).
- PE résout l'IP publique ? → zone
privatelink.*manquante. - VMs ne sortent pas (Standard LB) ? → outbound rule ou NAT Gateway.
- App Service backend AGW = 404 ? → Pick host name from backend = Yes.
- Tunnel S2S down ? → PSK + IPsec policy identiques des 2 côtés.
- P2S marche que vers anciens VNets ? → re-télécharger le client après changement de topologie.
- Monitoring hybride ? → Connection Monitor (Arc).
- Multi-region web + WAF ? → Front Door ; TCP/UDP global → Cross-Region LB ; tout protocole via DNS → Traffic Manager.