Skip to content

make "az postgres flexible-server connect" able to recognize already logged in az account #33366

@eprigorodov

Description

@eprigorodov

Preconditions

  • No need to upgrade Python SDK or the Python SDK is ready.

Related command

az postgres flexible-server connect

Resource Provider

Microsoft.DBforPostgreSQL/flexibleServers

Description of Feature or Work Requested

In the present version 2.86.0 az postgres flexible-server connect supports only username + password authentication. That works well for PostgreSQL internal / admin accounts and not that well for Entra ID accounts.

In the case of authenticating with Entra ID account the CLI expects not the user's password, but an authentication token which can be obtained by running:

az account get-access-token --resource https://ossrdbms-aad.database.windows.net

Feature request is to make az postgres flexible-server connect try using the already authenticated account first:

  • if parameters --admin-user and --admin-password do not specify any other credentials
  • then check if authentication refresh token exists and is valid,
  • if yes, then obtain the token for the target server scope,
  • then use account name from the token cache and password from the access token.

Minimum API Version Required

N/A

Swagger PR link / SDK link

N/A

Request Example

No response

Target Date

2026-12-31

PM Contact

@pm

Engineer Contact

@engineer

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions