Skip to content

[Network] az network application-gateway waf-policy managed-rule rule-set update: Allow updating rule group without rule IDs - #33871

Merged
Ethan Yang (necusjz) merged 1 commit into
Azure:devfrom
huiii99:fix-33271-waf-rule-set-update
Aug 12, 2026
Merged

[Network] az network application-gateway waf-policy managed-rule rule-set update: Allow updating rule group without rule IDs#33871
Ethan Yang (necusjz) merged 1 commit into
Azure:devfrom
huiii99:fix-33271-waf-rule-set-update

Conversation

@huiii99

@huiii99 Jian Hui (huiii99) commented Aug 11, 2026

Copy link
Copy Markdown
Member

Related command
az network application-gateway waf-policy managed-rule rule-set update

Description
Fixes #33271

Allow --group-name to be provided without --rule, as documented. This creates an empty rule group override and disables all rules in that group. Providing --rule without --group-name remains invalid.

Testing Guide
azdev test test_network_app_gateway_waf_policy_compute_disabled_rule --live

History Notes


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

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@yonzhan

Copy link
Copy Markdown
Collaborator

Network

@huiii99
Jian Hui (huiii99) marked this pull request as ready for review August 11, 2026 06:36
@huiii99
Jian Hui (huiii99) requested a review from a team as a code owner August 11, 2026 06:36
Copilot AI lite review requested due to automatic review settings August 11, 2026 06:36
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@huiii99

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the az network application-gateway waf-policy managed-rule rule-set update command behavior to match its documentation by allowing --group-name to be specified without any --rule entries, creating an empty rule-group override that disables all rules in that group (fixing #33271).

Changes:

  • Relaxed CLI validation to allow --group-name without --rule, while still rejecting --rule without --group-name.
  • Updated the managed rule-set update implementation to create a rule-group override whenever --group-name is provided (even when no rules are specified).
  • Added a live test case (and recording) verifying that a group-only update produces an empty rules override and corresponding computedDisabledRules.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/azure-cli/azure/cli/command_modules/network/custom.py Allows creating a rule-group override on update even when no rule IDs are provided.
src/azure-cli/azure/cli/command_modules/network/_validators.py Updates validation to permit --group-name without --rule, and improves the error message for the invalid opposite case.
src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_commands.py Adds a live scenario assertion for group-only update behavior (empty override rules + computed disabled rules).
src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_app_gateway_waf_policy_compute_disabled_rule.yaml Updates the recording to include the new group-only update interaction.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +3425 to +3429
self.cmd('network application-gateway waf-policy managed-rule rule-set update -g {rg} '
'--policy-name {policy_name} '
'--type {policy_type} '
'--version {policy_version} '
'--group-name {empty_rule_group_name}',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks for making user's input a test case,

az network application-gateway waf-policy managed-rule rule-set update --policy-name Maruthi3rdWAF-eastus2euap -g MaruthiRGNRP2-eastus2euap --type Microsoft_DefaultRuleSet --version 2.1 --group-name LFI

@necusjz Ethan Yang (necusjz) changed the title [Network] az network application-gateway waf-policy managed-rule rule-set update: Allow updating a rule group without rule IDs [Network] az network application-gateway waf-policy managed-rule rule-set update: Allow updating rule group without rule IDs Aug 12, 2026
@necusjz
Ethan Yang (necusjz) merged commit 43eaf89 into Azure:dev Aug 12, 2026
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-quality-productivity-squad 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.

Azure CLI is throwing an error of "--rules and --rule-group-name must be provided at the same time" for azure web application firewall

5 participants