Skip to content

[PostgreSQL] BREAKING CHANGE: az postgres flexible-server: Refactor network commands and validation logic#33192

Open
nachoalonsoportillo wants to merge 11 commits intoAzure:devfrom
nachoalonsoportillo:implement-new-behavior-with-network-components
Open

[PostgreSQL] BREAKING CHANGE: az postgres flexible-server: Refactor network commands and validation logic#33192
nachoalonsoportillo wants to merge 11 commits intoAzure:devfrom
nachoalonsoportillo:implement-new-behavior-with-network-components

Conversation

@nachoalonsoportillo
Copy link
Copy Markdown
Member

@nachoalonsoportillo nachoalonsoportillo commented Apr 15, 2026

Related command

az postgres flexible-server create, az postgres flexible-server geo-restore, az postgres flexible-server replica create, az postgres flexible-server restore, and az postgres flexible-server revive-dropped,

Description

  • Update test cases for PostgreSQL flexible server replication with VNET integrated servers, and VNet management to include private DNS zone handling.
  • Enhance validation logic to support subnet and VNet ID resolution.
  • Improve error messages for clarity and consistency.
  • Rewrite tests to adjust to current behavior.

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-prefixes and --subnet-prefixes anymore
[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-prefixes and --subnet-prefixes anymore


This checklist is used to make sure that common guidelines for a pull request are followed.

Copilot AI review requested due to automatic review settings April 15, 2026 22:13
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Apr 15, 2026

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Apr 15, 2026

❌AzureCLI-BreakingChangeTest
❌postgresql
rule cmd_name rule_message suggest_message
1007 - ParaRemove postgres flexible-server create cmd postgres flexible-server create removed parameter subnet_address_prefix please add back parameter subnet_address_prefix for cmd postgres flexible-server create
1007 - ParaRemove postgres flexible-server create cmd postgres flexible-server create removed parameter vnet_address_prefix please add back parameter vnet_address_prefix for cmd postgres flexible-server create
1007 - ParaRemove postgres flexible-server geo-restore cmd postgres flexible-server geo-restore removed parameter subnet_address_prefix please add back parameter subnet_address_prefix for cmd postgres flexible-server geo-restore
1007 - ParaRemove postgres flexible-server geo-restore cmd postgres flexible-server geo-restore removed parameter vnet_address_prefix please add back parameter vnet_address_prefix for cmd postgres flexible-server geo-restore
1007 - ParaRemove postgres flexible-server replica create cmd postgres flexible-server replica create removed parameter subnet_address_prefix please add back parameter subnet_address_prefix for cmd postgres flexible-server replica create
1007 - ParaRemove postgres flexible-server replica create cmd postgres flexible-server replica create removed parameter vnet_address_prefix please add back parameter vnet_address_prefix for cmd postgres flexible-server replica create
1007 - ParaRemove postgres flexible-server restore cmd postgres flexible-server restore removed parameter subnet_address_prefix please add back parameter subnet_address_prefix for cmd postgres flexible-server restore
1007 - ParaRemove postgres flexible-server restore cmd postgres flexible-server restore removed parameter vnet_address_prefix please add back parameter vnet_address_prefix for cmd postgres flexible-server restore
1007 - ParaRemove postgres flexible-server revive-dropped cmd postgres flexible-server revive-dropped removed parameter subnet_address_prefix please add back parameter subnet_address_prefix for cmd postgres flexible-server revive-dropped
1007 - ParaRemove postgres flexible-server revive-dropped cmd postgres flexible-server revive-dropped removed parameter vnet_address_prefix please add back parameter vnet_address_prefix for cmd postgres flexible-server revive-dropped
⚠️ 1004 - CmdPropRemove postgres flexible-server create cmd postgres flexible-server create removed property deprecate_info_target
⚠️ 1004 - CmdPropRemove postgres flexible-server geo-restore cmd postgres flexible-server geo-restore removed property deprecate_info_target
⚠️ 1004 - CmdPropRemove postgres flexible-server replica create cmd postgres flexible-server replica create removed property deprecate_info_target
⚠️ 1004 - CmdPropRemove postgres flexible-server restore cmd postgres flexible-server restore removed property deprecate_info_target
⚠️ 1004 - CmdPropRemove postgres flexible-server revive-dropped cmd postgres flexible-server revive-dropped removed property deprecate_info_target
❌storage
rule cmd_name rule_message suggest_message
1007 - ParaRemove storage blob generate-sas cmd storage blob generate-sas removed parameter user_delegation_tid please add back parameter user_delegation_tid for cmd storage blob generate-sas
1007 - ParaRemove storage container generate-sas cmd storage container generate-sas removed parameter user_delegation_tid please add back parameter user_delegation_tid for cmd storage container generate-sas
1007 - ParaRemove storage file generate-sas cmd storage file generate-sas removed parameter user_delegation_tid please add back parameter user_delegation_tid for cmd storage file generate-sas
1007 - ParaRemove storage fs directory generate-sas cmd storage fs directory generate-sas removed parameter user_delegation_tid please add back parameter user_delegation_tid for cmd storage fs directory generate-sas
1007 - ParaRemove storage fs file generate-sas cmd storage fs file generate-sas removed parameter user_delegation_tid please add back parameter user_delegation_tid for cmd storage fs file generate-sas
1007 - ParaRemove storage fs generate-sas cmd storage fs generate-sas removed parameter user_delegation_tid please add back parameter user_delegation_tid for cmd storage fs generate-sas
1007 - ParaRemove storage queue generate-sas cmd storage queue generate-sas removed parameter user_delegation_tid please add back parameter user_delegation_tid for cmd storage queue generate-sas
1007 - ParaRemove storage share generate-sas cmd storage share generate-sas removed parameter user_delegation_tid please add back parameter user_delegation_tid for cmd storage share generate-sas

Please submit your Breaking Change Pre-announcement ASAP if you haven't already. Please note:

  • Breaking changes can only be merged during the designated breaking change window
  • A pre-announcement must be released at least one month in advance

For more details on how to introduce breaking changes, refer to the documentation: azure-cli/doc/how_to_introduce_breaking_changes.md

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
3 pipeline(s) require an authorized user to comment /azp run to run.

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Apr 15, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py and wired it into create/restore/replica flows.
  • Simplified network_commands.py to 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.

Comment thread src/azure-cli/azure/cli/command_modules/postgresql/utils/validators.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/postgresql/_params.py
…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
Copy link
Copy Markdown

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
Copy link
Copy Markdown

Azure Pipelines:
3 pipeline(s) require an authorized user to comment /azp run to run.

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
3 pipeline(s) require an authorized user to comment /azp run to run.

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
3 pipeline(s) require an authorized user to comment /azp run to run.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/azure-cli/azure/cli/command_modules/postgresql/utils/validators.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/postgresql/utils/validators.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/postgresql/_help.py Outdated
@azure-pipelines
Copy link
Copy Markdown

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
Copy link
Copy Markdown

Azure Pipelines:
3 pipeline(s) require an authorized user to comment /azp run to run.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@calvinhzy
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 3 pipeline(s).

@calvinhzy calvinhzy changed the title [PostgreSQL] Refactor network commands and validation logic [PostgreSQL] BREAKING CHANGE: az postgres flexible-server: Refactor network commands and validation logic Apr 16, 2026
@calvinhzy
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 3 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
3 pipeline(s) require an authorized user to comment /azp run to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants