@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