[PostgreSQL] BREAKING CHANGE: az postgres flexible-server: Refactor network commands and validation logic#33192
Conversation
️✔️AzureCLI-FullTest
|
❌AzureCLI-BreakingChangeTest
Please submit your Breaking Change Pre-announcement ASAP if you haven't already. Please note:
|
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
|
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
Note
Copilot was unable to run its full agentic suite in this review.
Refactors PostgreSQL flexible server networking into shared validation utilities, updates command behavior to rely on pre-existing network resources, and adjusts scenario/validator tests accordingly.
Changes:
- Moved/centralized network configuration building (subnet/VNet/DNS zone resolution, public access IP detection) into
validators.pyand wired it into create/restore/replica flows. - Simplified
network_commands.pyto only support migrate-network, removing prior network resource provisioning behavior. - Updated and reworked scenario tests for VNet + replication flows; removed the dedicated private DNS zone scenario test file and expanded validator negative cases.
Reviewed changes
Copilot reviewed 15 out of 22 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/postgresql/utils/validators.py | Adds network configuration helpers, subnet/DNS resolution, and public access IP auto-detection. |
| src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_vnet.py | Rewrites VNet scenario tests to use explicit subnet + private DNS zone IDs and validate migrate-network behavior. |
| src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica.py | Updates replica scenario to use private networking with DNS zones and adds switchover/standalone promotion coverage. |
| src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_private_dns_zone.py | Removes private DNS zone scenario tests. |
| src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands.py | Expands validator-negative coverage for subnet/VNet/DNS zone argument combinations. |
| src/azure-cli/azure/cli/command_modules/postgresql/commands/replica_commands.py | Switches replica create networking from network_commands to build_network_configuration. |
| src/azure-cli/azure/cli/command_modules/postgresql/commands/network_commands.py | Deletes private/public network preparation logic; keeps migrate-network only. |
| src/azure-cli/azure/cli/command_modules/postgresql/commands/custom_commands.py | Uses build_network_configuration and resolve_private_dns_zone_id instead of network_commands helpers. |
| src/azure-cli/azure/cli/command_modules/postgresql/aaz/latest/network/vnet/subnet/_update.py | Updates help text to use “identifier” wording for consistency. |
| src/azure-cli/azure/cli/command_modules/postgresql/aaz/latest/network/vnet/subnet/_create.py | Updates help text to use “identifier” wording for consistency. |
| src/azure-cli/azure/cli/command_modules/postgresql/aaz/latest/network/vnet/_update.py | Updates help text to use “identifier” wording for consistency. |
| src/azure-cli/azure/cli/command_modules/postgresql/aaz/latest/network/vnet/_create.py | Updates help text to use “identifier” wording for consistency. |
| src/azure-cli/azure/cli/command_modules/postgresql/_params.py | Removes --address-prefixes / --subnet-prefixes args and updates networking help text. |
| src/azure-cli/azure/cli/command_modules/postgresql/_help.py | Updates examples/docs to match “existing network resources” behavior and “identifier” wording. |
| src/azure-cli/azure/cli/command_modules/postgresql/_breaking_change.py | Removes previously registered breaking-change messaging for the networking behavior/args. |
Comments suppressed due to low confidence (1)
src/azure-cli/azure/cli/command_modules/postgresql/_params.py:1
- This PR removes the ability to provide
--address-prefixes/--subnet-prefixes(and changes networking behavior to require pre-existing resources), which is a customer-facing breaking change. The PR description doesn't explicitly call out the breaking/removal aspect, and the prior breaking-change registration for these flags is also removed elsewhere. Please update the PR description/history notes (or restore an appropriate breaking-change notice) to accurately reflect the behavioral/parameter break.
# --------------------------------------------------------------------------------------------
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…tion - Reduced the maximum length for random variable names in tests to 15. - Updated test cases to check for specific CLI errors when creating PostgreSQL flexible servers with invalid configurations, including missing private DNS zones and incorrectly formed identifiers. - Enhanced error messages in the validators for private DNS zones and subnet identifiers to provide clearer guidance on usage. - Ensured that tests cover various invalid scenarios for private DNS zones and network configurations.
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
…ators.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
…le server replica tests
…s://github.com/nachoalonsoportillo/azure-cli into implement-new-behavior-with-network-components
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
…P address detection
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 22 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
- Changed the import of CLIError from azure.cli.core._profile to knack.util. - Updated regex in test_postgres_flexible_commands.py to escape backslashes in invalid VNet and subnet names. - Enhanced validation logic in validators.py to ensure subnet names are valid when resolving private subnet IDs.
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 22 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
az postgres flexible-server: Refactor network commands and validation logic
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
… instead of 'all'; add checks for master server deletion in replication tests.
Related command
az postgres flexible-server create,az postgres flexible-server geo-restore,az postgres flexible-server replica create,az postgres flexible-server restore, andaz postgres flexible-server revive-dropped,Description
Testing Guide
History Notes
[PostgreSQL] BREAKING CHANGE:
az postgres flexible-server create/geo-restore/restore/revive-dropped: Don't create or alter networking components like virtual network, subnet, or private DNS zone. Stop supporting--address-prefixesand--subnet-prefixesanymore[PostgreSQL] BREAKING CHANGE:
az postgres flexible-server replica create: Don't create or alter networking components like virtual network, subnet, or private DNS zone. Stop supporting--address-prefixesand--subnet-prefixesanymoreThis 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.