Application Gateway v2を理解するための前提
Application Gateway v2はregional Layer 7 reverse proxy/load balancerで、HTTP(S)、WebSocket、TLS termination、path/host routing等を提供する。 v2 productionの中心はStandard_v2/WAF_v2。v1は2026-04-28にretire済みで新規設計の対象にしない。
frontend listener→request routing rule→backend pool + backend setting→health probeという参照関係でdata pathを構成する。 backend network sourceはApplication Gateway instance private IPで、original clientはx-forwarded-for等のHTTP headerとして渡される。
HTTPS backendではbackend settingのHost/SNIとserver certificate subject/trusted rootの整合がhealth/live trafficに影響する。 v2はautoscaling、zone redundancy、static VIP等を備え、private-only frontendもcurrent supported configuration。
Control plane / Data plane / Observability
listenerがIP/port/protocol/hostを受ける。
ruleがhost/path等でbackend pool/settingsを選ぶ。
Gateway instanceが新しいconnectionをbackendへ張り、X-Forwarded-*でclient contextを渡す。
Client-to-backend path
- clientがApplication Gateway frontend listenerへHTTP(S) requestを送る。
- HTTPS listenerならGatewayでclient-side TLSを終端する。
- listener/routing ruleがhost/path等からbackend poolとbackend settingを選ぶ。
- health stateがHealthyなbackendへGateway instanceから新しいbackend connectionを張る。
- backendはsourceとしてGateway instance private IPを見て、original clientはX-Forwarded-For等で受け取る。
- backend responseをGatewayがclient connectionへ返し、rewrite/WAF等のconfigured processingを適用する。
仕組みを分解する
Application GatewayはLoad Balancerと違いproxyです。client側connectionとbackend側connectionは別です。そのためNSG/route調査ではclient→frontendとGateway instance→backendを分離し、client IP要件はpacket sourceではなくX-Forwarded-For trust chainを含めて設計します。TLSもfrontend terminationとbackend TLSの2区間でcertificate/SNIを別々に確認します。
運用時はresource configurationだけで完了判定せず、実clientからの名前解決、TCP/TLS handshake、HTTP status、backend側のsource IP/Host/header、health telemetryを同じtimestampで揃えます。load balancer/proxyがhealthyでもapplication dependencyが壊れている場合があり、逆にbackend applicationが正常でもhealth probe条件やrouting ruleが不整合ならtrafficは到達しません。
設計判断
| 判断軸 | 設計方針 |
|---|---|
| Standard_v2 vs WAF_v2 | L7 routingだけならStandard_v2、managed WAFが必要ならWAF_v2。Basic previewをproduction要件へ安易に採用しない。 |
| Frontend | public/private/bothを要件で選ぶ。private-onlyはnetwork isolation/current feature条件を確認する。 |
| Host preservation | origin/appのredirect/cookie/authがhost依存ならoriginal Hostを保持する設計を優先する。 |
| TLS | client cert/mTLS、frontend cert、backend trust/SNIを区間ごとにdocumentする。 |
確認手順
Read-only verification
- listener、rule、backend pool、backend setting、probeのresource ID参照を辿る。
- Backend healthでHealthy/Unhealthy/Unknownと詳細reasonを取得する。
- backend access logでsource IPとX-Forwarded-For/Hostを確認する。
- HTTPS backendではopenssl/curl等で証明書CN/SANと設定Host/SNIを比較する。
Evidence to keep
- resource ID / subscription / region / frontend / backend targetを保存し、同名resource取り違えを防ぐ。
- DNS answer、source IP、destination IP/port、Host/SNI、health status、timestampを同じincident recordへ残す。
- 変更前後で同じclient journeyをnew connectionとして再実行する。
- Portal表示だけでなくCLI/PowerShell/APIまたはlogsを併用し、観測面の一時差を識別する。
az network application-gateway show -g <rg> -n <appgw> -o jsonc
az network application-gateway rule list -g <rg> --gateway-name <appgw> -o table
az network application-gateway show-backend-health -g <rg> -n <appgw> -o jsoncGet-AzApplicationGateway -ResourceGroupName <rg> -Name <appgw>
Get-AzApplicationGatewayBackendHealth -Name <appgw> -ResourceGroupName <rg>
障害切り分け
| 症状 | 第一候補 | 証拠 | 次の確認 |
|---|---|---|---|
| Frontend 502 | all backend unhealthy/TLS | Backend health + access log | probe/TLS/DNSを確認 |
| redirect hostがおかしい | Host override | backend log/Location header | host preservation |
| client IPがGateway IP | packet sourceを見ている | X-Forwarded-For | trusted proxy chain設定 |
| HTTPS backend probe failure | SNI/CN/root mismatch | probe detail/cert | backend Host/SNI修正 |
| 一部pathだけ404 | routing rule/path map | rule config | path order/rewrites確認 |
変更時の確認と rollback
- listener/rule/backend setting/probeをexportしてから変更する。
- certificate replacementはfrontend/backend TLSを分け、旧certをrollback可能に保持する。
- routing changeはhost/pathごとのsynthetic testを用意する。
- rollback後はclient→frontend→backendの同一request IDでend-to-end確認する。
Current notes — 2026-09-11
Application Gateway v1は2026-04-28に廃止済みで、Microsoftによるpatch・support・SLA保証はありません。残存v1のtrafficも保証されないため、現行設計と継続運用はv2へ移行します。v2ではprivate-only frontend、autoscaling、zone redundancy、static VIP等を利用できます。
Related articles
Official sources
動作、retirement、feature availability、health/TLS behaviorはMicrosoft Learnのcurrent documentationを基準に確認しています。production変更時は対象subscription/region/SKUの最新documentationとresource provider stateを再確認してください。