Azure / Azure/azure-cli

Parameter `--source-addresses` is not optional for a NatRule

Open
#26,336 1 comment 0 reactions 1 assignee Claimed by @necusjz View on GitHub
act-quality-productivity-squad Auto-Assign Azure CLI Team customer-reported feature-request Network
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

The parameter `--source-addresses` is not optional for `NatRule`, without it `az network firewall policy rule-collection-group collection rule add` command will fails with:
> Operation returned an invalid status 'Bad Request'

Example failing command:

```
$ az network firewall policy rule-collection-group collection rule add \
> -g $RG \
> --policy-name fw-policy \
> --collection-name nat_collection \
> --rcg-name collection-1 \
> --name port-8082-to-spoke1-web-server \
> --rule-type NatRule \
> --description "port-8082-to-spoke1-web-server" \
> --destination-addresses "$fwpublicaddr" \
> --destination-ports 8082 \
> --translated-address "10.1.10.4" \
> --translated-port 80 \
> --ip-protocols TCP
Command group 'network firewall policy rule-collection-group collection rule' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Operation returned an invalid status 'Bad Request'
```

Example working command:
```
$ az network firewall policy rule-collection-group collection rule add \
> -g $RG \
> --policy-name fw-policy \
> --collection-name nat_collection \
> --rcg-name collection-1 \
> --name port-8082-to-spoke1-web-server \
> --rule-type NatRule \
> --source-addresses "*" \
> --description "port-8082-to-spoke1-web-server" \
> --destination-addresses "$fwpublicaddr" \
> --destination-ports 8082 \
> --translated-address "10.1.10.4" \
> --translated-port 80 \
> --ip-protocols TCP
Command group 'network firewall policy rule-collection-group collection rule' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstCommand group 'network firewall policy rule-collection-group collection rule' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
{
"etag": "953489d1-2b14-48f4-adfb-319c61f808e7",

... snipped ...

"type": "Microsoft.Network/FirewallPolicies/RuleCollectionGroups"
}
```

Please consider:
1. Improving the documentation.
2. Improving command validation and error messages returned to the client to avoid unhelpful "Bad request" messages.
3. Adding several command examples for the various rule types.

Thanks!

---
#### Document Details

⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*

* ID: 51bc8847-2744-bb66-7b83-0518aa47536c
* Version Independent ID: c1c31748-e899-dd98-e418-e01ed781a14a
* Content: [az network firewall policy rule-collection-group collection rule](https://learn.microsoft.com/en-us/cli/azure/network/firewall/policy/rule-collection-group/collection/rule?view=azure-cli-latest)
* Content Source: [latest/docs-ref-autogen/network/firewall/policy/rule-collection-group/collection/rule.yml](https://github.com/MicrosoftDocs/azure-docs-cli/blob/main/latest/docs-ref-autogen/network/firewall/policy/rule-collection-group/collection/rule.yml)
* Service: **virtual-network**
* GitHub Login: @rloutlaw
* Microsoft Alias: **routlaw**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.