Application Gateway
The presented resiliency recommendations in this guidance include Application Gateway, Web Application Firewall and associated settings.
Summary of Recommendations
Recommendation | Category | Impact | State | ARG Query Available |
---|---|---|---|---|
AGW-1 - Set a minimum instance count of 2 | System Efficiency | High | Preview | Yes |
AGW-2 - Secure all incoming connections with SSL | Access & Security | High | Preview | Yes |
AGW-3 - Enable WAF policies | Access & Security | High | Preview | Yes |
AGW-4 - Use Application GW V2 instead of V1 | System Efficiency | High | Preview | Yes |
AGW-5 - Monitor and Log the configurations and traffic | Monitoring | Medium | Preview | No |
AGW-6 - Use Health Probes to detect backend availability | Monitoring | Medium | Preview | Yes |
AGW-7 - Deploy Application Gateway in a zone-redundant configuration | Availability | High | Preview | Yes |
AGW-8 - Plan for backend maintenance by using connection draining | Governance | Medium | Preview | Yes |
AGW-9 - Ensure Application Gateway Subnet is using a /24 subnet mask | Networking | High | Preview | Yes |
Recommendations Details
AGW-1 - 最小インスタンス数を 2 に設定します
Category: System Efficiency
Impact: High
Guidance
Azure Application Gateway v2 は常に高可用性方式でデプロイされ、自動スケールの構成に関係なく、既定で複数のインスタンスと共にデプロイされます。ただし、新しいインスタンスの作成には最大で 6 分から 7 分かかる場合があります。さまざまな障害モードでのダウンタイムを回避するために、最小インスタンス数を 2 に設定し、理想的にはアベイラビリティーゾーンをサポートすることをお勧めします。これにより、通常の状況では、Azure Application Gateway に常に少なくとも 2 つのインスタンスが存在することになります。そのうちの 1 つに問題が発生した場合、新しいインスタンスが作成されている間、トラフィックを処理する別のインスタンスが常に存在します。また、Auto Scaling を引き続き活用して、手動による介入を必要とせずに、トラフィック要件に基づいて動的にスケールアウトします。
Resources
Resource Graph Query
// Azure Resource Graph Query
// This query will return all Application Gateways that do not have autoscale enabled or have a min capacity of 1
resources
| where type =~ "microsoft.network/applicationGateways"
| where isnull(properties.autoscaleConfiguration) or properties.autoscaleConfiguration.minCapacity <= 1
| project recommendationId = "agw-1", name, id, tags, param1 = "autoScaleConfiguration: isNull or MinCapacity <= 1"
| order by id asc
AGW-2 - すべての着信接続をSSLで保護します
Category: Access & Security
Impact: High
Guidance
すべての着信接続が運用サービスに HTTPS を使用していることを確認します。エンド ツー エンドの SSL/TLS または SSL/TLS ターミネーションを使用して Application Gateway へのすべての受信接続のセキュリティを確保すると、Web サーバーとブラウザー間でやり取りされるすべてのデータがプライベートで暗号化されたままになるため、管理者とユーザーは攻撃の可能性から保護されます。
Resources
- Application Gateway Security
- Application Gateway SSL Overview
- Application Gateway SSL Policy Overview
- Application Gateway KeyVault Certs
- Application Gateway SSL Cert Management
Resource Graph Query
// Azure Resource Graph Query
// You can use the following Azure Resource Graph query to check if an HTTP rule is using an SSL certificate or is using Azure Key Vault to store the certificates
resources
| where type =~ "microsoft.network/applicationGateways"
| mv-expand frontendPorts = properties.frontendPorts
| mv-expand httpListeners = properties.httpListeners
| where isnull(parse_json(httpListeners.properties.sslCertificate))
| project recommendationId="agw-2", name, id, tags, param1=strcat("frontendPort: ", frontendPorts.properties.port), param2="tls: false"
AGW-3 - Web アプリケーション ファイアウォール ポリシーを有効にします
Category: Access & Security
Impact: High
Guidance
アプリケーション仮想ネットワーク内の Web アプリケーション ファイアウォール (WAF) で Application Gateway を使用して、インターネットからの受信 HTTP/S トラフィックを保護します。WAFは、OWASP(Open Web Application Security Project)のコアルールセットに基づくルールを使用して、潜在的なエクスプロイトから一元的に保護します。
Resources
- Well-Architected Framework Application Gateway Overview
- Application Gateway - Web Application Firewall
Resource Graph Query
// Azure Resource Graph Query
// This query will return all Application Gateways that do not have WAF enabled
Resources
| where type =~ "microsoft.network/applicationGateways"
| where properties.firewallpolicy != ""
| project recommendationId = "agw-3", name, id, tags, param1 = "webApplicationFirewallConfiguration: isNull"
| order by id asc
AGW-4 - Application GW V1 の代わりに V2 を使用します
Category: System Efficiency
Impact: High
Guidance
Application Gateway v1 を使用するやむを得ない理由がない限り、v2 を使用する必要があります。V2 には、自動スケーリング、静的 VIP、証明書管理のための Azure KeyVault 統合など、さらに多くの機能が組み込まれており、比較表に記載されている機能も多数あります。この更新されたバージョンを活用することで、パフォーマンスが向上し、トラフィックのルーティング方法を制御し、トラフィックに変更を加えることができます。
Resources
- Application Gateway Overview V2
- Application Gateway Feature Comparison Between V1 and V2
- Application Gateway V1 Retirement
Resource Graph Query
// Azure Resource Graph Query
// Get all Application Gateways, which are using the deprecated V1 SKU
resources
| where type =~ 'microsoft.network/applicationgateways'
| extend tier = properties.sku.tier
| where tier == 'Standard' or tier == 'WAF'
| project recommendationId = "agw-4", name, id, tags
AGW-5 - 構成とトラフィックを監視してログに記録します
Category: Monitoring
Impact: Medium
Guidance
ストレージ アカウント、Log Analytics、その他の監視サービスに格納できるログを有効にします。NSG を適用すると、トラフィック監査のために NSG フロー ログを有効にして保存し、Azure クラウドに流れ込むトラフィックに関する分析情報を提供できます。
Resources
Resource Graph Query
// cannot-be-validated-with-arg
AGW-6 - 正常性プローブを使用してバックエンドの可用性を検出します
Category: Monitoring
Impact: Medium
Guidance
カスタム正常性プローブを使用すると、バックエンドの可用性を把握し、バックエンド サービスに何らかの影響があるかどうかを監視できます。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Application Gateways are not using health probes to monitor the availability of the backend systems
resources
| where type =~ "microsoft.network/applicationGateways"
| where array_length(properties.probes) == 0
| project recommendationId="agw-6", name, id, tags, param1="customHealthProbeUsed: false"
AGW-7 - ゾーン冗長構成で Application Gateway をデプロイします
Category: Availability
Impact: High
Guidance
ゾーン対応構成で Application Gateway をデプロイすると、特定のゾーンがダウンした場合でも、他のゾーンにある他のサービスは引き続き使用できるため、お客様は引き続きサービスにアクセスできます。
Resources
Resource Graph Query
// Azure Resource Graph Query
// list Application Gateways that are not configured to use at least 2 Availability Zones
resources
| where type =~ "microsoft.network/applicationGateways"
| where isnull(zones) or array_length(zones) < 2
| extend zoneValue = iff((isnull(zones)), "null", zones)
| project recommendationId = "agw-7", name, id, tags, param1="Zones: No Zone or Zonal", param2=strcat("Zones value: ", zoneValue )
AGW-8 - 接続ドレインを使用してバックエンド メンテナンスを計画します
Category: Governance
Impact: Medium
Guidance
接続ドレインを使用してバックエンドのメンテナンスを計画します。接続ドレインは、計画されたサービスの更新やバックエンドの正常性の問題中に、バックエンド プール メンバーを正常に削除するのに役立ちます。この設定は、バックエンド設定で有効になり、ルールの作成時にすべてのバックエンド プール メンバーに適用されます。
Resources
Resource Graph Query
// Azure Resource Graph Query
// This query will check if connection draining is enabled
resources
| where type =~ "microsoft.network/applicationGateways"
| mv-expand backendHttpSettings = properties.backendHttpSettingsCollection
| extend connectionDrainingEnabled = backendHttpSettings.properties.connectionDraining.enabled
| where connectionDrainingEnabled != true
| extend backendPoolName = backendHttpSettings.name
| project recommendationId = "agw-8", name, id, tags, param1 = "connectionDraining: Disabled", param2 = strcat("backendSettingsName: ", backendPoolName)
AGW-9 - Application Gateway サブネットが /24 サブネット マスクを使用していることを確認します
Category: Networking
Impact: High
Recommendation/Guidance
Application Gateway (Standard_v2 または WAF_v2 SKU) では、最大 125 個のインスタンスをサポートできます。Application Gateway v2 SKU のデプロイごとに /24 サブネットは必要ありませんが、強くお勧めします。これは、Application Gateway v2 に、自動スケーリングの拡張とメンテナンス アップグレードのための十分な領域を確保するためです。
Resources
Resource Graph Query
// Azure Resource Graph Query
// This query will validate the subnet id for an appGW ends with a /24
resources
| where type =~ 'Microsoft.Network/applicationGateways'
| extend subnetid = tostring(properties.gatewayIPConfigurations[0].properties.subnet.id)
| join kind=leftouter(resources
| where type == "microsoft.network/virtualnetworks"
| mv-expand properties.subnets
| extend subnetid = tostring(properties_subnets.id)
| extend addressprefix = tostring(properties_subnets.properties.addressPrefix)
| project subnetid, addressprefix) on subnetid
| where addressprefix !endswith '/24'
| project recommendationID = "agw-9", name, id, tags, param1 = strcat('AppGW subnet prefix: ', addressprefix)