make "az postgres flexible-server connect" able to recognize already logged in az account
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
### Preconditions
- [x] 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_
Contributor guide
Assessment
This issue has not been assessed yet.