Skip to content

[POSTGRESQL] az postgres flexible-server create/restore/geo-restore/replica create: Add new arguments --federated-client-id and --backup-federated-client-id to support multi-tenant application registration#33645

Open
nasc17 wants to merge 2 commits into
Azure:devfrom
nasc17:nasc/crossTenantCommands

Conversation

@nasc17

@nasc17 nasc17 commented Jun 24, 2026

Copy link
Copy Markdown
Member

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

Description
Allow support for servers with Azure Key Vault from a different Microsoft Entra tenant using multi-tenant application registration.

Testing Guide
Manual

History Notes
[POSTGRESQL] az postgres flexible-server create/restore/geo-restore/replica create: Add new arguments --federated-client-id and --backup-federated-client-id to support multi-tenant application registration

@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

Hi @nasc17,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd

Copy link
Copy Markdown
Validation for Breaking Change Starting...

Thanks for your contribution!

@yonzhan

yonzhan commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

POSTGRESQL

@nasc17 nasc17 changed the title [POSTGRESQL] az postgres flexible-server create/restore/geo-restore/replica create: Add new arguments --federated-client-id and --geo-backup-federated-client-id to support multi-tenant application registration [POSTGRESQL] az postgres flexible-server create/restore/geo-restore/replica create: Add new arguments --federated-client-id and --backup-federated-client-id to support multi-tenant application registration Jun 26, 2026
@nasc17 nasc17 marked this pull request as ready for review June 26, 2026 20:02
@nasc17 nasc17 requested review from Pan-Qi and VeryEarly as code owners June 26, 2026 20:02
Copilot AI review requested due to automatic review settings June 26, 2026 20:02
@nasc17 nasc17 requested a review from YangAn-microsoft as a code owner June 26, 2026 20:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the PostgreSQL flexible server BYOK (Azure Key Vault) flow to support multi-tenant application registration by introducing new CLI arguments for federated identity client IDs, and wiring them through validation and request payload construction.

Changes:

  • Added --federated-client-id and --backup-federated-client-id CLI parameters and surfaced them in help.
  • Extended BYOK validation to account for federated client IDs.
  • Passed federated client IDs into the DataEncryption payload when building server parameters.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/postgresql/utils/validators.py Adds federated client ID validation to BYOK validator flow.
src/azure-cli/azure/cli/command_modules/postgresql/utils/_flexible_server_util.py Extends BYOK identity/encryption payload builder to include federated client IDs.
src/azure-cli/azure/cli/command_modules/postgresql/commands/replica_commands.py Threads new federated client ID args through replica create validation and payload building.
src/azure-cli/azure/cli/command_modules/postgresql/commands/custom_commands.py Threads new federated client ID args through create/restore/update/geo-restore command paths.
src/azure-cli/azure/cli/command_modules/postgresql/_params.py Adds the new arguments to command argument contexts.
src/azure-cli/azure/cli/command_modules/postgresql/_help.py Documents an example of using --federated-client-id for cross-tenant Key Vault.

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

Comment on lines 78 to +79
geo_redundant_backup=None, byok_identity=None, byok_key=None, backup_byok_identity=None, backup_byok_key=None,
federated_client_id=None, geo_backup_federated_client_id=None,
Comment on lines +142 to +143
federated_client_id=federated_client_id,
geo_backup_federated_client_id=geo_backup_federated_client_id,
Comment on lines +186 to +187
federated_client_id=federated_client_id,
geo_backup_federated_client_id=geo_backup_federated_client_id)
Comment on lines +334 to +336
byok_identity=None, byok_key=None, backup_byok_identity=None, backup_byok_key=None,
federated_client_id=None, geo_backup_federated_client_id=None,
storage_type=None, yes=False):
Comment on lines +372 to +374
pg_byok_validator(byok_identity, byok_key, backup_byok_identity, backup_byok_key, geo_redundant_backup,
federated_client_id=federated_client_id,
geo_backup_federated_client_id=geo_backup_federated_client_id)
Comment on lines +738 to +739
federated_client_id=federated_client_id,
geo_backup_federated_client_id=geo_backup_federated_client_id)
Comment on lines +772 to +773
federated_client_id=federated_client_id,
geo_backup_federated_client_id=geo_backup_federated_client_id)
Comment on lines +402 to +406
raise ArgumentUsageError('To use --federated-client-id or --geo-backup-federated-client-id, '
'provide --identity and --key together.')
if not (instance.data_encryption and instance.data_encryption.type == 'AzureKeyVault'):
logger.warning('You cannot update data encryption properties on a server '
'that was not created with data encryption..')
Comment on lines +410 to +412
raise ArgumentUsageError('The primary federated client ID and backup federated client ID cannot be the same. '
'Provide different IDs for --federated-client-id and '
'--geo-backup-federated-client-id.')
Comment on lines 374 to +377
def build_identity_and_data_encryption(db_engine, byok_identity=None, backup_byok_identity=None,
byok_key=None, backup_byok_key=None, instance=None):
byok_key=None, backup_byok_key=None,
federated_client_id=None, backup_federated_client_id=None,
instance=None):
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.

4 participants