Skip to content

Commit 95da559

Browse files
fix: Update app gw subnet recommendation to reflect Advisor recs. (#776)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 8135dfb commit 95da559

2 files changed

Lines changed: 23 additions & 15 deletions

File tree

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
// Azure Resource Graph Query
22
// This query will validate the subnet id for an appGW ends with a /24
3-
43
resources
5-
| where type =~ 'Microsoft.Network/applicationGateways'
6-
| extend subnetid = tostring(properties.gatewayIPConfigurations[0].properties.subnet.id)
7-
| join kind=leftouter(resources
4+
| where type == "microsoft.network/applicationgateways"
5+
| extend subnetId = tostring(properties.gatewayIPConfigurations[0].properties.subnet.id)
6+
| project id, subscriptionId, subnetId, name, tags
7+
| join (
8+
resources
89
| where type == "microsoft.network/virtualnetworks"
9-
| mv-expand properties.subnets
10-
| extend subnetid = tostring(properties_subnets.id)
11-
| extend addressprefix = tostring(properties_subnets.properties.addressPrefix)
12-
| project subnetid, addressprefix) on subnetid
13-
| where addressprefix !endswith '/24'
14-
| project recommendationId = "8364fd0a-7c0e-e240-9d95-4bf965aec243", name, id, tags, param1 = strcat('AppGW subnet prefix: ', addressprefix)
15-
10+
| project id, subnets = properties.subnets
11+
| mv-expand subnets
12+
| mv-expand subnets.properties.addressPrefixes
13+
| project
14+
id,
15+
subnetId = tostring(subnets.id),
16+
prefix1 = subnets.properties.addressPrefix,
17+
prefix2 = subnets.properties.addressPrefixes
18+
| mv-expand prefix2
19+
| extend prefix = iff(isnotnull(prefix1), prefix1, prefix2)
20+
| extend subnetPrefixLength = split(prefix, "/")[1]
21+
) on subnetId
22+
| where subnetPrefixLength > 24 and subnetPrefixLength != 64
23+
| project recommendationId = "8364fd0a-7c0e-e240-9d95-4bf965aec243",name,id,tags,param1 = strcat("AppGW subnet prefix: ", prefix)

azure-resources/Network/applicationGateways/recommendations.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,16 @@
134134
- name: Application Gateway Connection Draining
135135
url: "https://learn.microsoft.com/azure/application-gateway/features#connection-draining"
136136

137-
- description: Ensure Application Gateway Subnet is using a /24 subnet mask
137+
- description: A minimum subnet size of /24 is recommended for Application Gateway v2 subnets.
138138
aprlGuid: 8364fd0a-7c0e-e240-9d95-4bf965aec243
139-
recommendationTypeId: null
139+
recommendationTypeId: ef4da732-f541-4109-bc0e-465c68b6c7eb
140140
recommendationControl: OtherBestPractices
141141
recommendationImpact: High
142142
recommendationResourceType: Microsoft.Network/applicationGateways
143143
recommendationMetadataState: Active
144144
longDescription: |
145-
Application Gateway v2 (Standard_v2 or WAF_v2 SKU) can support up to 125 instances. A /24 subnet isn't mandatory for deployment but is advised to provide enough space for autoscaling and maintenance upgrades.
146-
potentialBenefits: Allows autoscaling and maintenance
145+
Application Gateway (Standard_v2 or WAF_v2 SKU) can support up to 125 instances (125 instance IP addresses + 1 private frontend IP configuration + 5 Azure reserved). A minimum subnet size of /24 is recommended.
146+
potentialBenefits: Enough room for scalability
147147
pgVerified: true
148148
automationAvailable: true
149149
tags: []

0 commit comments

Comments
 (0)