Skip to content

[PostgreSQL] az postgres flexible-server restore/geo-restore: Add --tags parameter#32998

Open
nachoalonsoportillo wants to merge 3 commits intoAzure:devfrom
nachoalonsoportillo:add-tags-to-geo-restore
Open

[PostgreSQL] az postgres flexible-server restore/geo-restore: Add --tags parameter#32998
nachoalonsoportillo wants to merge 3 commits intoAzure:devfrom
nachoalonsoportillo:add-tags-to-geo-restore

Conversation

@nachoalonsoportillo
Copy link
Copy Markdown
Member

@nachoalonsoportillo nachoalonsoportillo commented Mar 21, 2026

Related command
az postgres flexible-server restore
az postgres flexible-server geo-restore

Description
Add support for providing tags to be added to the restored server.

Testing Guide
az postgres fexible-server geo-restore ... --tags tag_key=tag_value
Confirm that the resulting restored server has the provided tags associated to the resource.
az postgres fexible-server restore ... --tags tag_key=tag_value
Confirm that the resulting restored server has the provided tags associated to the resource.

History Notes

[POSTGRESQL] az postgres flexible-server restore/geo-restore: Add --tags parameter to support providing tags to associate to restored server


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 March 21, 2026 21:21
@azure-client-tools-bot-prd
Copy link
Copy Markdown

Validation for Azure CLI Full Test Starting...

Thanks for your contribution!

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

Validation for Breaking Change Starting...

Thanks for your contribution!

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Mar 21, 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

Adds support for passing resource tags to the restored server when running az postgres flexible-server geo-restore, aligning geo-restore behavior with other server creation flows that already support tags.

Changes:

  • Adds a tags parameter to flexible_server_georestore and includes it in the Server create payload.
  • Exposes --tags on the postgres flexible-server geo-restore command argument context.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/azure-cli/azure/cli/command_modules/postgresql/commands/custom_commands.py Accepts tags for geo-restore and forwards them into the SDK Server(...) parameters.
src/azure-cli/azure/cli/command_modules/postgresql/_params.py Wires up --tags for the postgres flexible-server geo-restore command.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 737 to 745
parameters = postgresql_flexibleservers.models.Server(
point_in_time_utc=restore_point_in_time,
location=location,
source_server_resource_id=source_server_id,
create_mode="GeoRestore",
availability_zone=zone,
storage=storage
storage=storage,
tags=tags
)
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

--tags support was added for geo-restore (passed into the Server create payload), but there doesn't appear to be a scenario test asserting that tags provided to geo-restore are actually applied on the restored server resource. Please add/extend the existing geo-restore test to pass --tags and validate the resulting server has those tags.

Copilot uses AI. Check for mistakes.
@yonzhan yonzhan requested a review from calvinhzy March 22, 2026 03:35
@nachoalonsoportillo nachoalonsoportillo changed the title [PostgreSQL] az postgres flexible-server geo-restore: Add --tags parameter [PostgreSQL] az postgres flexible-server restore & geo-restore: Add --tags parameter Mar 22, 2026
@calvinhzy calvinhzy changed the title [PostgreSQL] az postgres flexible-server restore & geo-restore: Add --tags parameter [PostgreSQL] az postgres flexible-server restore/geo-restore: Add --tags parameter Mar 23, 2026
@calvinhzy
Copy link
Copy Markdown
Member

@nachoalonsoportillo Please add tests for this new param.

@nachoalonsoportillo
Copy link
Copy Markdown
Member Author

nachoalonsoportillo commented Mar 26, 2026

@nachoalonsoportillo Please add tests for this new param.

@calvinhzy, our backend still doesn't handle resource tags properly for PITR and GeoRestore scenarios. I've created a PR in our RP's repo to fix that. Once it's reviewed, merged, and deployed to production, I'll complete this PR with the corresponding tests, and have it ready for review, approval and merge.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants