Skip to content

Commit a469a8c

Browse files
authored
{Network} AppGateway WAF support HTTPDDoS rule set (#32374)
1 parent fd20f92 commit a469a8c

25 files changed

+5629
-2617
lines changed

src/azure-cli/azure/cli/command_modules/network/_actions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
# Copyright (c) Microsoft Corporation. All rights reserved.
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
5+
# pylint: disable=line-too-long
56

67
from collections import defaultdict
78

89
import argparse
910
from knack.util import CLIError
10-
from azure.cli.core.azclierror import UnrecognizedArgumentError
11+
from azure.cli.core.azclierror import UnrecognizedArgumentError, InvalidArgumentValueError
1112
from ._validators import read_base_64_file
1213

1314

@@ -184,7 +185,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
184185
elif kl == 'state':
185186
d['state'] = v[0]
186187
elif kl == 'sensitivity':
188+
if v[0].lower() not in ['low', 'medium', 'high']:
189+
raise InvalidArgumentValueError("sensitivity must be one of 'low', 'medium', or 'high'.")
187190
d['sensitivity'] = v[0]
188191
else:
189-
raise UnrecognizedArgumentError('key error: key must be one of rule-id, action and state.')
192+
raise UnrecognizedArgumentError('key error: key must be one of rule-id, action, state, and sensitivity.')
190193
return d

src/azure-cli/azure/cli/command_modules/network/_help.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@
15361536
short-summary: The rule that will be disabled. If none specified, all rules in the group will be disabled. If provided, --group-name must be provided too.
15371537
long-summary: |
15381538
Usage: --rule rule-id=MyID state=MyState action=MyAction sensitivity=MySensitivity
1539-
Allowed values for sensitivity: High, Medium, Low, None
1539+
Allowed values for sensitivity: High, Medium, Low
15401540
Multiple rules can be specified by using more than one `--rule` argument.
15411541
examples:
15421542
- name: Disable an attack protection rule

src/azure-cli/azure/cli/command_modules/network/_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def load_arguments(self, _):
226226
with self.argument_context('network application-gateway waf-policy') as c:
227227
c.argument('policy_name', name_arg_type, id_part='name', help='The name of the application gateway WAF policy.')
228228
c.argument('rule_set_type', options_list='--type',
229-
arg_type=get_enum_type(['Microsoft_BotManagerRuleSet', 'Microsoft_DefaultRuleSet', 'OWASP']),
229+
arg_type=get_enum_type(['Microsoft_BotManagerRuleSet', 'Microsoft_DefaultRuleSet', 'OWASP', 'Microsoft_HTTPDDoSRuleSet']),
230230
help='The type of the web application firewall rule set.')
231231
c.argument('rule_set_version',
232232
options_list='--version',

src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/_create.py

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class Create(AAZCommand):
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2024-07-01",
25+
"version": "2025-03-01",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgatewaywebapplicationfirewallpolicies/{}", "2024-07-01"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgatewaywebapplicationfirewallpolicies/{}", "2025-03-01"],
2828
]
2929
}
3030

@@ -390,7 +390,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
390390
_element.sensitivity = AAZStrArg(
391391
options=["sensitivity"],
392392
help="Describes the override sensitivity to be applied when rule matches.",
393-
enum={"High": "High", "Low": "Low", "Medium": "Medium", "None": "None"},
393+
enum={"High": "High", "Low": "Low", "Medium": "Medium"},
394394
)
395395
_element.state = AAZStrArg(
396396
options=["state"],
@@ -614,7 +614,7 @@ def url_parameters(self):
614614
def query_parameters(self):
615615
parameters = {
616616
**self.serialize_query_param(
617-
"api-version", "2024-07-01",
617+
"api-version", "2025-03-01",
618618
required=True,
619619
),
620620
}
@@ -969,6 +969,9 @@ def _build_schema_on_200_201(cls):
969969
properties.enable_http2 = AAZBoolType(
970970
serialized_name="enableHttp2",
971971
)
972+
properties.entra_jwt_validation_configs = AAZListType(
973+
serialized_name="entraJWTValidationConfigs",
974+
)
972975
properties.firewall_policy = AAZObjectType(
973976
serialized_name="firewallPolicy",
974977
)
@@ -1116,6 +1119,9 @@ def _build_schema_on_200_201(cls):
11161119
properties.cookie_based_affinity = AAZStrType(
11171120
serialized_name="cookieBasedAffinity",
11181121
)
1122+
properties.dedicated_backend_connection = AAZBoolType(
1123+
serialized_name="dedicatedBackendConnection",
1124+
)
11191125
properties.host_name = AAZStrType(
11201126
serialized_name="hostName",
11211127
)
@@ -1137,9 +1143,18 @@ def _build_schema_on_200_201(cls):
11371143
properties.request_timeout = AAZIntType(
11381144
serialized_name="requestTimeout",
11391145
)
1146+
properties.sni_name = AAZStrType(
1147+
serialized_name="sniName",
1148+
)
11401149
properties.trusted_root_certificates = AAZListType(
11411150
serialized_name="trustedRootCertificates",
11421151
)
1152+
properties.validate_cert_chain_and_expiry = AAZBoolType(
1153+
serialized_name="validateCertChainAndExpiry",
1154+
)
1155+
properties.validate_sni = AAZBoolType(
1156+
serialized_name="validateSNI",
1157+
)
11431158

11441159
authentication_certificates = cls._schema_on_200_201.properties.application_gateways.Element.properties.backend_http_settings_collection.Element.properties.authentication_certificates
11451160
authentication_certificates.Element = AAZObjectType()
@@ -1175,6 +1190,9 @@ def _build_schema_on_200_201(cls):
11751190
)
11761191

11771192
properties = cls._schema_on_200_201.properties.application_gateways.Element.properties.backend_settings_collection.Element.properties
1193+
properties.enable_l4_client_ip_preservation = AAZBoolType(
1194+
serialized_name="enableL4ClientIpPreservation",
1195+
)
11781196
properties.host_name = AAZStrType(
11791197
serialized_name="hostName",
11801198
)
@@ -1202,6 +1220,38 @@ def _build_schema_on_200_201(cls):
12021220
custom_error_configurations.Element = AAZObjectType()
12031221
_CreateHelper._build_schema_application_gateway_custom_error_read(custom_error_configurations.Element)
12041222

1223+
entra_jwt_validation_configs = cls._schema_on_200_201.properties.application_gateways.Element.properties.entra_jwt_validation_configs
1224+
entra_jwt_validation_configs.Element = AAZObjectType()
1225+
1226+
_element = cls._schema_on_200_201.properties.application_gateways.Element.properties.entra_jwt_validation_configs.Element
1227+
_element.etag = AAZStrType(
1228+
flags={"read_only": True},
1229+
)
1230+
_element.id = AAZStrType()
1231+
_element.name = AAZStrType()
1232+
_element.properties = AAZObjectType(
1233+
flags={"client_flatten": True},
1234+
)
1235+
1236+
properties = cls._schema_on_200_201.properties.application_gateways.Element.properties.entra_jwt_validation_configs.Element.properties
1237+
properties.audiences = AAZListType()
1238+
properties.client_id = AAZStrType(
1239+
serialized_name="clientId",
1240+
)
1241+
properties.provisioning_state = AAZStrType(
1242+
serialized_name="provisioningState",
1243+
flags={"read_only": True},
1244+
)
1245+
properties.tenant_id = AAZStrType(
1246+
serialized_name="tenantId",
1247+
)
1248+
properties.un_authorized_request_action = AAZStrType(
1249+
serialized_name="unAuthorizedRequestAction",
1250+
)
1251+
1252+
audiences = cls._schema_on_200_201.properties.application_gateways.Element.properties.entra_jwt_validation_configs.Element.properties.audiences
1253+
audiences.Element = AAZStrType()
1254+
12051255
frontend_ip_configurations = cls._schema_on_200_201.properties.application_gateways.Element.properties.frontend_ip_configurations
12061256
frontend_ip_configurations.Element = AAZObjectType()
12071257

@@ -1543,6 +1593,9 @@ def _build_schema_on_200_201(cls):
15431593
)
15441594

15451595
properties = cls._schema_on_200_201.properties.application_gateways.Element.properties.probes.Element.properties
1596+
properties.enable_probe_proxy_protocol_header = AAZBoolType(
1597+
serialized_name="enableProbeProxyProtocolHeader",
1598+
)
15461599
properties.host = AAZStrType()
15471600
properties.interval = AAZIntType()
15481601
properties.match = AAZObjectType()
@@ -1656,6 +1709,10 @@ def _build_schema_on_200_201(cls):
16561709
serialized_name="backendHttpSettings",
16571710
)
16581711
_CreateHelper._build_schema_sub_resource_read(properties.backend_http_settings)
1712+
properties.entra_jwt_validation_config = AAZObjectType(
1713+
serialized_name="entraJWTValidationConfig",
1714+
)
1715+
_CreateHelper._build_schema_sub_resource_read(properties.entra_jwt_validation_config)
16591716
properties.http_listener = AAZObjectType(
16601717
serialized_name="httpListener",
16611718
)
@@ -1867,6 +1924,9 @@ def _build_schema_on_200_201(cls):
18671924
)
18681925

18691926
client_auth_configuration = cls._schema_on_200_201.properties.application_gateways.Element.properties.ssl_profiles.Element.properties.client_auth_configuration
1927+
client_auth_configuration.verify_client_auth_mode = AAZStrType(
1928+
serialized_name="verifyClientAuthMode",
1929+
)
18701930
client_auth_configuration.verify_client_cert_issuer_dn = AAZBoolType(
18711931
serialized_name="verifyClientCertIssuerDN",
18721932
)
@@ -3427,6 +3487,9 @@ def _build_schema_network_interface_read(cls, _schema):
34273487
)
34283488

34293489
properties = _schema_network_interface_read.properties.private_link_service.properties
3490+
properties.access_mode = AAZStrType(
3491+
serialized_name="accessMode",
3492+
)
34303493
properties.alias = AAZStrType(
34313494
flags={"read_only": True},
34323495
)
@@ -3678,6 +3741,9 @@ def _build_schema_network_security_group_read(cls, _schema):
36783741
serialized_name="provisioningState",
36793742
flags={"read_only": True},
36803743
)
3744+
properties.record_types = AAZStrType(
3745+
serialized_name="recordTypes",
3746+
)
36813747
properties.retention_policy = AAZObjectType(
36823748
serialized_name="retentionPolicy",
36833749
)

src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/_delete.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class Delete(AAZCommand):
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2024-07-01",
25+
"version": "2025-03-01",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgatewaywebapplicationfirewallpolicies/{}", "2024-07-01"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgatewaywebapplicationfirewallpolicies/{}", "2025-03-01"],
2828
]
2929
}
3030

@@ -145,7 +145,7 @@ def url_parameters(self):
145145
def query_parameters(self):
146146
parameters = {
147147
**self.serialize_query_param(
148-
"api-version", "2024-07-01",
148+
"api-version", "2025-03-01",
149149
required=True,
150150
),
151151
}

0 commit comments

Comments
 (0)