Skip to content

[Network] az network application-gateway waf-policy managed-rule exception: Support exception feature in application gateway#31610

Merged
necusjz merged 3 commits intoAzure:devfrom
cxznmhdcxz:application-gateway-exception-feature
Jun 10, 2025
Merged

[Network] az network application-gateway waf-policy managed-rule exception: Support exception feature in application gateway#31610
necusjz merged 3 commits intoAzure:devfrom
cxznmhdcxz:application-gateway-exception-feature

Conversation

@cxznmhdcxz
Copy link
Member

@cxznmhdcxz cxznmhdcxz commented Jun 6, 2025

Related command

az network application-gateway waf-policy managed-rule exception add/list/remove

Description

resolve #31597

aaz Azure/aaz#776
Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jun 6, 2025

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.9
️✔️acs
️✔️latest
️✔️3.12
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.9
️✔️ams
️✔️latest
️✔️3.12
️✔️3.9
️✔️apim
️✔️latest
️✔️3.12
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️aro
️✔️latest
️✔️3.12
️✔️3.9
️✔️backup
️✔️latest
️✔️3.12
️✔️3.9
️✔️batch
️✔️latest
️✔️3.12
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.9
️✔️billing
️✔️latest
️✔️3.12
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.9
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.9
️✔️config
️✔️latest
️✔️3.12
️✔️3.9
️✔️configure
️✔️latest
️✔️3.12
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.9
️✔️container
️✔️latest
️✔️3.12
️✔️3.9
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.9
️✔️core
️✔️latest
️✔️3.12
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.9
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.9
️✔️dls
️✔️latest
️✔️3.12
️✔️3.9
️✔️dms
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.9
️✔️find
️✔️latest
️✔️3.12
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.9
️✔️identity
️✔️latest
️✔️3.12
️✔️3.9
️✔️iot
️✔️latest
️✔️3.12
️✔️3.9
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.9
️✔️lab
️✔️latest
️✔️3.12
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️maps
️✔️latest
️✔️3.12
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.9
️✔️network
️✔️latest
️✔️3.12
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.9
️✔️profile
️✔️latest
️✔️3.12
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.9
️✔️redis
️✔️latest
️✔️3.12
️✔️3.9
️✔️relay
️✔️latest
️✔️3.12
️✔️3.9
️✔️resource
️✔️latest
️✔️3.12
️✔️3.9
️✔️role
️✔️latest
️✔️3.12
️✔️3.9
️✔️search
️✔️latest
️✔️3.12
️✔️3.9
️✔️security
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.9
️✔️sql
️✔️latest
️✔️3.12
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.9
️✔️storage
️✔️latest
️✔️3.12
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.9
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.9
️✔️util
️✔️latest
️✔️3.12
️✔️3.9
️✔️vm
️✔️latest
️✔️3.12
️✔️3.9

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jun 6, 2025

⚠️AzureCLI-BreakingChangeTest
⚠️network
rule cmd_name rule_message suggest_message
⚠️ 1011 - SubgroupAdd network application-gateway waf-policy managed-rule exception sub group network application-gateway waf-policy managed-rule exception added

@yonzhan
Copy link
Collaborator

yonzhan commented Jun 6, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link

github-actions bot commented Jun 6, 2025

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for managed rule exceptions in application gateway WAF policies by introducing new CLI commands for adding, listing, and removing exceptions.

  • Introduces a new test for the exception command in the network module.
  • Implements a new custom function to remove WAF managed rule exceptions.
  • Updates the commands and help documentation to include the exception commands.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/latest/test_network_commands.py Adds a new test function for WAF policy exception commands.
custom.py Implements the remove function for managed rule exceptions using an inline class.
commands.py Registers new CLI commands for exception removal and listing under the proper command group.
aaz/latest/network/application_gateway/waf_policy/managed_rule/exception/init.py Sets up module exports for the exception commands.
aaz/latest/network/application_gateway/waf_policy/managed_rule/exception/__cmd_group.py Defines the command group for exception commands.
_help.py Adds help documentation for exception commands.
Comments suppressed due to low confidence (1)

src/azure-cli/azure/cli/command_modules/network/custom.py:2199

  • [nitpick] Consider adding a docstring to the nested class 'WAFExceptionRemove' to clarify its purpose and improve maintainability.
class WAFExceptionRemove(Update):

Comment on lines +3003 to +3005
self.cmd('network application-gateway waf-policy managed-rule exception add -g {rg} --policy-name {waf} '
'--match-variable "RequestURI" --value-match-operator "Contains" --values "health" "account/images" "default.aspx" '
'--rule-sets [0].rule-set-type=OWASP [0].rule-set-version=3.2')
Copy link

Copilot AI Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] For better readability and maintainability, consider splitting the long command string into multiple lines or using a variable to store the command arguments.

Suggested change
self.cmd('network application-gateway waf-policy managed-rule exception add -g {rg} --policy-name {waf} '
'--match-variable "RequestURI" --value-match-operator "Contains" --values "health" "account/images" "default.aspx" '
'--rule-sets [0].rule-set-type=OWASP [0].rule-set-version=3.2')
exception_args = {
'match_variable': "RequestURI",
'value_match_operator': "Contains",
'values': '"health" "account/images" "default.aspx"',
'rule_sets': '[0].rule-set-type=OWASP [0].rule-set-version=3.2'
}
self.cmd(
'network application-gateway waf-policy managed-rule exception add -g {rg} --policy-name {waf} '
'--match-variable {match_variable} --value-match-operator {value_match_operator} --values {values} '
'--rule-sets {rule_sets}'.format(**exception_args)
)

Copilot uses AI. Check for mistakes.
@necusjz necusjz merged commit 1dbd9c9 into Azure:dev Jun 10, 2025
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Network az network vnet/lb/nic/dns/etc...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Creating CLI for Exception (Allow List) feature in Application Gateway

3 participants

Comments