question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

az cdn endpoint rule add does not parse match-values correctly

See original GitHub issue

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az cdn endpoint rule add

Errors:

(BadRequest) Rules validation failed. More information: Value {} is not a valid IP Address in rule iprestriction.
Code: BadRequest
Message: Rules validation failed. More information: Value {} is not a valid IP Address in rule iprestriction.

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Create a CDN profile and endpoint. I am using Premium Verizon.
  • az cdn endpoint rule add -g {} -n {} --profile-name {} --order 1 --rule-name iprestriction --match-variable RemoteAddress --operator IPMatch --negate-condition true --match-values 1.2.3.4/32,5.6.7.8/32 --action-name UrlRedirect --redirect-type PermanentRedirect --custom-path /403 --debug

Expected Behavior

Where the parameter passed to match-values is a comma separated list of IP addresses in CIDR notation, multiple values should be added to the rule’s match values (docs).

For example --match-values 1.2.3.4/32,5.6.7.8/32 should produce a rule that matches those two IP addresses.

Looking at the debug output, the request seems to combine the two IP addresses into a single, invalid string like

“matchValues”: [“1.2.3.4/32,5.6.7.8/32”]

Environment Summary

Linux-4.19.104-microsoft-standard-x86_64-with-debian-buster-sid, Ubuntu 18.04.4 LTS
Python 3.6.10
Installer: DEB

azure-cli 2.33.1

Extensions:
azure-iot 0.13.0

Dependencies:
msal 1.16.0
azure-mgmt-resource 20.0.0

Additional Context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
t-bzhancommented, Apr 8, 2022

@chris-hibberd, CLI’s collection property like --match-values use the space as the separator. You command should go like:

az cdn endpoint rule add -g bzhan-poc -n cachekeytest --profile-name msft-test --order 1 --rule-name iprestriction --match-variable RemoteAddress --operator IPMatch --negate-condition true --match-values 1.2.3.4/32 5.6.7.8/32 --action-name UrlRedirect --redirect-type PermanentRedirect --custom-path /403 --debug

The commands works as expected per my test: image

1reaction
SaurabhSharma-MSFTcommented, Feb 26, 2022

@yonzhan I could see some different error however I could see that IP addresses are passed as single string and thus redirecting this to services team.

Read more comments on GitHub >

github_iconTop Results From Across the Web

az cdn endpoint rule | Microsoft Learn
Manage delivery rules for an endpoint. In this article. Commands; az cdn endpoint rule add; az cdn endpoint rule remove; az cdn endpoint...
Read more >
What is the correct Azure CLI command for creating HTTP ...
UPDATE 2: The following Azure help page suggests az cdn endpoint rule action add is correct, but it still doesn't work (provides cryptic...
Read more >
azure-cli 2.23.0 - PyPI
az cdn endpoint rule add : Fix delivery rule creation for non-Microsoft SKU (#17822) ... Fix #12291: az storage blob generate-sas does not...
Read more >
Configuring Clusters OpenShift Container Platform 3.11
Another method to access the metrics is to use a cluster role. You still need to enable the endpoint, but you do not...
Read more >
Chrome Enterprise Lab - Schema
The autoscaler can add instances but not remove any. ... Cloud CDN will not apply any default negative caching when a policy exists....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found