[Network] az network public-ip create/update: Add --ddos-custom-policy to attach a DDoS custom policy to a public IP - #33812
Open
huiii99 wants to merge 3 commits into
Open
Conversation
microsoft-github-policy-service
Bot
requested review from
jsntcy,
necusjz and
yonzhan
July 30, 2026 07:31
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Bump the api-version on Microsoft.Network/publicIPAddresses request URIs from 2024-07-01 to 2025-07-01 in recordings whose CommandName is a 'network public-ip' command (excluding 'network public-ip prefix' and public-ip sub-resources such as ddosProtectionStatus, which retain their own versions). Fixes VCR playback mismatches after the public-ip codegen was regenerated at 2025-07-01.
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
The 2025-07-01 public-ip codegen regeneration dropped the \ query parameter from 'network public-ip show' and 'network public-ip wait', which the breaking-change gate flagged as a removed parameter (1007 ParaRemove). Restore the --expand argument and \ query param on both commands to preserve backward compatibility.
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the network public-ip create/update experience to support associating a DDoS custom policy with a Public IP, aligning Azure CLI with the Microsoft.Network/publicIPAddresses capability added in API version 2025-07-01.
Changes:
- Add
--ddos-custom-policysupport foraz network public-ip createandaz network public-ip update. - Add a new scenario test covering attach/replace/remove of the policy on an eligible (instance-level) Public IP.
- Bump recorded test traffic across multiple modules to use
publicIPAddressesAPI version2025-07-01.
Reviewed changes
Copilot reviewed 130 out of 136 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/network/custom.py | Adds ddos_custom_policy handling for public IP create/update. |
| src/azure-cli/azure/cli/command_modules/network/_params.py | Wires --ddos-custom-policy argument and help text for public IP create/update. |
| src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/_delete.py | Updates Public IP delete to API version 2025-07-01 and updates operation naming. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_commands.py | Adds scenario test for attaching/replacing/removing a DDoS custom policy on a Public IP. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_vpn_connection_aux.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_vpn_connection_authentication.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_vpn_client_package.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_vnet_gateway_managed_identity.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_subnet_detach_nat_gateway.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_link_ip_config.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_zoned_public_ip.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_watcher_troubleshooting.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vpn_gateway_sku.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vpn_gateway_package_capture.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vpn_gateway_aad.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vpn_connection_nat_rule.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vpn_connection_ipsec.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vnet_peering.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vnet_peering_sync.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vnet_gateway_with_enable_private_ip_address.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vnet_gateway_nat_rule_sub_cmd.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vnet_gateway_multi_auth1.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vnet_gateway_multi_auth.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vnet_gateway_migration.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vnet_gateway_ipsec.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vnet_gateway_get_routes_and_resiliency_information.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vnet_gateway_expressroute_with_public_ip.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vnet_gateway_edge_zone.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_vnet_gateway_allow_traffic.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_virtual_hub_router_scenario.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_traffic_manager_subnet_routing.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_public_ip_zone.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_public_ip_prefix_with_ip_address.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_public_ip_edge_zone.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_nic.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_lb_with_cross_subscription_id.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_lb_sku.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_lb_front_ip.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_application_gateway_http_settings_validate_flags.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_appgw_creation_with_public_and_private_ip.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_app_gateway_with_waf_v2_sku.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_app_gateway_with_trusted_client_cert.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_app_gateway_with_ssl_profile.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_app_gateway_with_private_ip.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_app_gateway_with_defaults.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_app_gateway_with_cert_name.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_app_gateway_ssl_cert_managed_hsm.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_app_gateway_rewrite_rulesets.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ags_enable_probe_proxy_protocol_header.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ags_enable_l4_client_ip_preservation.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_zone.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_url_path_map.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_url_path_map_edge_case.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_settings.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_rule.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_routing_rule.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_root_cert.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_probe.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_probe_with_host_name_from_settings.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_listener.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_listener_with_host_names.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_http_settings.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_http_listener_with_waf_policy.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_http_listener_with_multi_host_names.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_frontend_ip_private.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_network_ag_auth_cert.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_natgateway_basic.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_manage_appgw_private_endpoint.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_manage_appgw_private_endpoint_without_standard.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_ddos_custom_policy_attach_to_lb_fip.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_appgw_with_tcp.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_appgw_private_endpoint_with_overwrite_default.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_appgw_private_endpoint_with_default.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_ag_rule_default_exists.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_ag_rule_create_preserves_http_settings_validate_flags.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vmss_single_placement_group_default_to_std_lb.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vmss_extended_location.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vmss_create_options.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vmss_create_none_options.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_windows_license_type.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_reimage.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_extended_location.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_custom_image_name_conflict.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_create_zones.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_create_state_modifications.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_create_none_options.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_create_existing_options.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_create_existing_nic.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_create_existing_ids_options.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_create_custom_ip.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_capture_zone_resilient_image.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_snapshot_create_with_source_blob_uri.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_shared_gallery.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_image_version_create_for_diff_source.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_create_vm_with_shared_gallery_image.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_create_disk_from_diff_gallery_image_version.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_tag_update_by_patch.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_clone_public_ip_metric_alerts_always_scenario.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/computefleet/tests/latest/recordings/test_all_launch_fleet_operations.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/computefleet/tests/latest/recordings/test_all_fleet_operations.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
| src/azure-cli/azure/cli/command_modules/computefleet/tests/latest/recordings/test_all_fleet_operations_using_alias.yaml | Updates recordings to publicIPAddresses API version 2025-07-01. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+5269
to
+5278
| if ddos_custom_policy: | ||
| if not is_valid_resource_id(ddos_custom_policy): | ||
| ddos_custom_policy = resource_id( | ||
| subscription=get_subscription_id(cmd.cli_ctx), | ||
| resource_group=resource_group_name, | ||
| namespace='Microsoft.Network', | ||
| type='ddosCustomPolicies', | ||
| name=ddos_custom_policy, | ||
| ) | ||
| public_ip_args['ddos_custom_policy'] = {'id': ddos_custom_policy} |
Comment on lines
5330
to
+5334
| def post_instance_update(self, instance): | ||
| if not has_value(instance.properties.ddos_settings.ddos_protection_plan.id): | ||
| instance.properties.ddos_settings.ddos_protection_plan = None | ||
| if not has_value(instance.properties.ddos_settings.ddos_custom_policy.id): | ||
| instance.properties.ddos_settings.ddos_custom_policy = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 PR Validation —⚠️ Review suggested
…blic IP
Related command
az network public-ip createaz network public-ip updateDescription
Implements Azure CLI request #33811 (follow-up to #33383, which added DDoS custom policy CRUD and LB frontend-ip linkage in #33413).
This PR adds a new
--ddos-custom-policyargument toaz network public-ip createandaz network public-ip update, letting users associate a DDoS custom policy with a public IP by name or resource ID.aaz Azure/aaz#1052
Testing Guide
azdev test test_ddos_custom_policy_attach_to_public_ipHistory Notes
[Network]
az network public-ip create: Add--ddos-custom-policyto attach a DDoS custom policy to a public IP[Network]
az network public-ip update: Add--ddos-custom-policyto attach, replace, or remove a DDoS custom policy on a public IPThis 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.