[Service Fabric] az sf managed-cluster network-security-rule add: Add new parameters for port ranges and address prefixes#31714
Conversation
️✔️AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| sf managed-cluster network-security-rule add | cmd sf managed-cluster network-security-rule add added parameter dest_addr_prefix |
||
| sf managed-cluster network-security-rule add | cmd sf managed-cluster network-security-rule add added parameter dest_port_range |
||
| sf managed-cluster network-security-rule add | cmd sf managed-cluster network-security-rule add added parameter source_addr_prefix |
||
| sf managed-cluster network-security-rule add | cmd sf managed-cluster network-security-rule add added parameter source_port_range |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
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). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull Request Overview
This PR updates the network security rule functionality for SF managed clusters by fixing test coverage issues and adding support for singular port range and address prefix parameters to better control inbound traffic.
- Updated test cases to validate both allow and deny network security rules.
- Added new parameters (source_port_range, dest_port_range, source_addr_prefix, dest_addr_prefix) in operations, _params, and _help modules.
- Revised help examples to demonstrate the usage of these new parameters.
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/servicefabric/tests/latest/test_sf_managed_cluster.py | Updated tests to include deny rule parameters and adjusted security rule checks. |
| src/azure-cli/azure/cli/command_modules/servicefabric/operations/managed_clusters.py | Integrated new singular port and address prefix parameters into the API call. |
| src/azure-cli/azure/cli/command_modules/servicefabric/_params.py | Added new argument definitions for singular port and address prefix parameters with corresponding help messages. |
| src/azure-cli/azure/cli/command_modules/servicefabric/_help.py | Updated help examples to include scenarios for using singular parameters. |
Comments suppressed due to low confidence (1)
src/azure-cli/azure/cli/command_modules/servicefabric/_params.py:296
- The help message for 'dest_addr_prefix' incorrectly states that '*' matches all source IPs; it should indicate that it matches all destination IPs for clarity.
c.argument('dest_addr_prefix', help='The destination address prefix. CIDR or destination IP range. Asterisk \'*\' can also be used to match all source IPs. Default tags such as \'VirtualNetwork\', \'AzureLoadBalancer\' and \'Internet\' can also be used.')
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
az sf managed-cluster network-security-rule add: Fix test_network_security_rule and add new parameter options for port ranges and address prefixesaz sf managed-cluster network-security-rule add: Add new parameter options for port ranges and address prefixes
az sf managed-cluster network-security-rule add: Add new parameter options for port ranges and address prefixesaz sf managed-cluster network-security-rule add: Add new parameters for port ranges and address prefixes
|
Please refer to this doc |
|
@zhoxing-ms Added history notes, please let me know if they are insufficient |

Related command
az sf managed-cluster network-security-rule addDescription
SF management ports 19000 and 19080 are considered high risk when exposed to Internet traffic. A recent failure to cleanup test resources left the resource with ports exposed and resulted in an incident (https://portal.microsofticm.com/imp/v5/incidents/details/647032599/summary).
This PR modifies the test_network_security_rule test to add a network security rule to deny inbound traffic to ports 19000 and 19080 from the internet. This should prevent the created resource from being flagged as high risk in the event another cleanup failure occurs. In order to add this rule, the
az sf managed-cluster network-security-rule addcommand was updated to take in parameters forsource_addr_prefix,dest_addr_prefix,source_port_range, anddest_port_rangeto allow the required input tags and port ranges.History Notes
[Service Fabric]
az sf managed-cluster network-security-rule: Add new parameter--source-addr-prefixto specify the CIDR or source IP range[Service Fabric]
az sf managed-cluster network-security-rule: Add new parameter--dest-addr-prefixto specify the destination port or range[Service Fabric]
az sf managed-cluster network-security-rule: Add new parameter--source-port-rangeto specify the CIDR or source IP range[Service Fabric]
az sf managed-cluster network-security-rule: Add new parameter--dest-port-rangeto specify the destination address prefixThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.