Skip to content

Commit 767907a

Browse files
karanbazazKaran Bazaz (from Dev Box)YanaXu
authored
PS changes to show appgw and agc in waf policy (#28197)
Co-authored-by: Karan Bazaz (from Dev Box) <kabazaz@microsoft.com> Co-authored-by: Yan Xu <yanxu1@microsoft.com>
1 parent 34a6331 commit 767907a

File tree

5 files changed

+96
-3
lines changed

5 files changed

+96
-3
lines changed

src/Network/Network.Test/ScenarioTests/ApplicationGatewayTests.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3027,7 +3027,11 @@ function Test-ApplicationGatewayTopLevelFirewallPolicy
30273027
$appgw = Get-AzApplicationGateway -Name $appgwName -ResourceGroupName $rgname
30283028
$policy = Get-AzApplicationGatewayFirewallPolicy -Name $wafPolicyName -ResourceGroupName $rgname
30293029

3030-
# Second check firewll policy
3030+
# Check if Application Gateway resource can be seen in WAF Policy
3031+
Assert-AreEqual $policy.ApplicationGateways.Count 1
3032+
Assert-AreEqual $policy.ApplicationGateways[0].Id $appgw.Id
3033+
3034+
# Second check firewall policy
30313035
Assert-AreEqual $policy.Id $appgw.FirewallPolicy.Id
30323036
Assert-AreEqual $policy.CustomRules[0].Name $rule.Name
30333037
Assert-AreEqual $policy.CustomRules[0].RuleType $rule.RuleType
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"Entries": [
3+
{
4+
"RequestUri": "/subscriptions/66de82f3-ad93-4605-bbdb-237fe7ef3a06/resourceGroups/appgwTest/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/testwafpolicy?api-version=2024-07-01",
5+
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNjZkZTgyZjMtYWQ5My00NjA1LWJiZGItMjM3ZmU3ZWYzYTA2L3Jlc291cmNlR3JvdXBzL2FwcGd3VGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0Lk5ldHdvcmsvQXBwbGljYXRpb25HYXRld2F5V2ViQXBwbGljYXRpb25GaXJld2FsbFBvbGljaWVzL3Rlc3R3YWZwb2xpY3k/YXBpLXZlcnNpb249MjAyNC0wNy0wMQ==",
6+
"RequestMethod": "GET",
7+
"RequestHeaders": {
8+
"Accept-Language": [
9+
"en-US"
10+
],
11+
"x-ms-client-request-id": [
12+
"3c7cba41-58c5-44b4-b9ab-0c151d8a00a1"
13+
],
14+
"User-Agent": [
15+
"FxVersion/8.0.1825.31117",
16+
"OSName/Windows",
17+
"OSVersion/Microsoft.Windows.10.0.26100",
18+
"Microsoft.Azure.Management.Network.NetworkManagementClient/27.0.0.0"
19+
]
20+
},
21+
"RequestBody": "",
22+
"ResponseHeaders": {
23+
"Cache-Control": [
24+
"no-cache"
25+
],
26+
"Pragma": [
27+
"no-cache"
28+
],
29+
"ETag": [
30+
"W/\"a949eda1-7aa8-45e2-8cb8-a841e9abfda9\""
31+
],
32+
"x-ms-request-id": [
33+
"e4bd761a-88f6-41a0-8365-1f0be052247e"
34+
],
35+
"x-ms-correlation-request-id": [
36+
"66c82526-dcbf-4c48-b285-883089b91c92"
37+
],
38+
"x-ms-arm-service-request-id": [
39+
"a2233ca6-235f-4819-afa5-d65697024b56"
40+
],
41+
"Strict-Transport-Security": [
42+
"max-age=31536000; includeSubDomains"
43+
],
44+
"x-ms-ratelimit-remaining-subscription-reads": [
45+
"1099"
46+
],
47+
"x-ms-ratelimit-remaining-subscription-global-reads": [
48+
"16499"
49+
],
50+
"x-ms-routing-request-id": [
51+
"WESTCENTRALUS:20250717T212311Z:66c82526-dcbf-4c48-b285-883089b91c92"
52+
],
53+
"X-Content-Type-Options": [
54+
"nosniff"
55+
],
56+
"X-Cache": [
57+
"CONFIG_NOCACHE"
58+
],
59+
"X-MSEdge-Ref": [
60+
"Ref A: E73FDF56A0D5454CA123397B9E08DFC2 Ref B: CYS013050704031 Ref C: 2025-07-17T21:23:11Z"
61+
],
62+
"Date": [
63+
"Thu, 17 Jul 2025 21:23:11 GMT"
64+
],
65+
"Content-Length": [
66+
"973"
67+
],
68+
"Content-Type": [
69+
"application/json; charset=utf-8"
70+
],
71+
"Expires": [
72+
"-1"
73+
]
74+
},
75+
"ResponseBody": "{\r\n \"name\": \"testwafpolicy\",\r\n \"id\": \"/subscriptions/66de82f3-ad93-4605-bbdb-237fe7ef3a06/resourceGroups/appgwTest/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/testwafpolicy\",\r\n \"etag\": \"W/\\\"a949eda1-7aa8-45e2-8cb8-a841e9abfda9\\\"\",\r\n \"type\": \"Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies\",\r\n \"location\": \"eastus2euap\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"customRules\": [],\r\n \"policySettings\": {\r\n \"requestBodyCheck\": true,\r\n \"maxRequestBodySizeInKb\": 128,\r\n \"fileUploadLimitInMb\": 100,\r\n \"state\": \"Disabled\",\r\n \"mode\": \"Detection\",\r\n \"requestBodyInspectLimitInKB\": 128,\r\n \"fileUploadEnforcement\": true,\r\n \"requestBodyEnforcement\": true\r\n },\r\n \"managedRules\": {\r\n \"managedRuleSets\": [\r\n {\r\n \"ruleSetType\": \"Microsoft_DefaultRuleSet\",\r\n \"ruleSetVersion\": \"2.1\",\r\n \"ruleGroupOverrides\": []\r\n }\r\n ],\r\n \"exclusions\": []\r\n },\r\n \"applicationGatewayForContainers\": [\r\n {\r\n \"id\": \"/subscriptions/66de82f3-ad93-4605-bbdb-237fe7ef3a06/resourcegroups/appgwtest/providers/microsoft.servicenetworking/trafficcontrollers/test1\"\r\n }\r\n ]\r\n }\r\n}",
76+
"StatusCode": 200
77+
}
78+
],
79+
"Names": {},
80+
"Variables": {
81+
"SubscriptionId": "66de82f3-ad93-4605-bbdb-237fe7ef3a06"
82+
}
83+
}

src/Network/Network/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
--->
2020

2121
## Upcoming Release
22+
* Returned appgw and agc in waf policy
2223
* Updated cmdlet `New-AzFirewallPolicyApplicationRule` to use HTTPS as the default protocol when creating a new FQDN Tag application rule.
2324
* Added `EnableDnstapLogging` parameter to `New-AzFirewall`
2425

src/Network/Network/Models/PSApplicationGatewayWebApplicationFirewallPolicy.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414
//
1515

16+
using Microsoft.Azure.Management.Network.Models;
1617
using Microsoft.WindowsAzure.Commands.Common.Attributes;
1718
using Newtonsoft.Json;
1819
using System.Collections.Generic;
@@ -32,5 +33,9 @@ public class PSApplicationGatewayWebApplicationFirewallPolicy : PSTopLevelResour
3233
public int? CustomBlockResponseStatusCode { get; set; }
3334

3435
public string CustomBlockResponseBody { get; set; }
36+
37+
public System.Collections.Generic.IList<ApplicationGateway> ApplicationGateways { get; set; }
38+
39+
public System.Collections.Generic.IList<ApplicationGatewayForContainersReferenceDefinition> ApplicationGatewayForContainers { get; set; }
3540
}
3641
}

src/Network/Network/help/Get-AzApplicationGatewayFirewallPolicy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ schema: 2.0.0
88
# Get-AzApplicationGatewayFirewallPolicy
99

1010
## SYNOPSIS
11-
Gets an application gateway firewall policy.
11+
Gets an application gateway or application gateway for containers firewall policy.
1212

1313
## SYNTAX
1414

@@ -18,7 +18,7 @@ Get-AzApplicationGatewayFirewallPolicy [-Name <String>] [-ResourceGroupName <Str
1818
```
1919

2020
## DESCRIPTION
21-
The **Get-AzApplicationGatewayFirewallPolicy** cmdlet gets an application gateway firewall policy..
21+
The **Get-AzApplicationGatewayFirewallPolicy** cmdlet gets an application gateway or application gateway for containers firewall policy..
2222

2323
## EXAMPLES
2424

0 commit comments

Comments
 (0)