Is there a way to get a Token for a User on Postgres Flexible Server without having to use azure-cli?

Souza Costa, Tarcisio 0 Reputation points
2024-09-25T14:02:54.73+00:00

I was looking for an alternative of azure-cli, an automatic way of obtaining tokens for regular postgres flexible server users. I wonder if it is really mandatory to use azure-cli for this task, it would be very time-consuming to ask all users to install azure-cli to request their tokens every time they want to connect or when the token has expired.

I found something from the documentation, but the code examples exist for applications, not for regular DB users. In those examples a client_id is needed, which does not seem to be valid for a user.

Thanks in advance!

Azure Database for PostgreSQL
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Oury Ba-MSFT 19,346 Reputation points Microsoft Employee
    2024-09-27T16:07:48.1033333+00:00

    @Souza Costa, Tarcisio Thank you for reaching out.

    If you are connecting using managed Identity, tokens do expire. The access token's validity is 5 minutes to 60 minutes. You should get the access token before initiating the sign-in to Azure Database for PostgreSQL. You can use Azure Data Studio, as per my knowledge I am not aware of any alternative for token generative.

    Regards,

    Oury


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.