Skip to content

Unclear docs and error message for --match-conditions format #29010

@ssolders

Description

@ssolders

Related command

az network application-gateway waf-policy custom-rule create \
--resource-group my-group \
--policy-name my-policy \
--name azuredevopsip \
--priority 10 \
--rule-type MatchRule \
--match-conditions '[{"variables": "RemoteAddr","operator":"IPMatch","values": ["'"$CURRENT_IP"'"]}]' \
--action Allow

Is your feature request related to a problem? Please describe.
When reading docs / looking at examples, I was not able to find any relevant information about how --match-conditions should be formatted.

When I ran this command I got the error Failed to parse '--match-conditions' argument: Model 'AAZObjectArg' has no field named 'RemoteAddr'

When running --match-conditions with ?? for docs it suggested variables [Required] Space-separated list of variables to use when matching. Variable values: RemoteAddr, RequestMethod, QueryString, PostArgs, RequestUri, RequestHeaders, RequestBody, RequestCookies. Try "??" to show more..

Documentation on azure-cli docs doesn't present any examples on --match-conditions.

Solution to this was to pass variables as an array of objects, where each key should have one of the values from RemoteAddr, RequestMethod, QueryString, PostArgs, RequestUri, RequestHeaders, RequestBody, RequestCookie.

Correct format:

--match-conditions '[{"variables":[{"variableName":"RemoteAddr"}],"operator":"IPMatch","values": ["'"$CURRENT_IP"'"]}]'

Describe the solution you'd like
The error message returned did not describe clear enough what the problem was, it suggested the variables key was not correct, but the docs referred to that it should be one of the RemoteAddr, RequestMethod, QueryString, PostArgs, RequestUri, RequestHeaders, RequestBody, RequestCookie.

Describe alternatives you've considered
Including example payloads of --match-conditions.

Additional context

Metadata

Metadata

Labels

Auto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamNetworkaz network vnet/lb/nic/dns/etc...act-quality-productivity-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions