Hi,@Rafael Gonçalves Welcome to the Microsoft Q&A platform, thanks for posting the question
Have you followed the prerequisites from this document if you are trying to connect from VNET.
Also please follow this document on using python to connect Postgres flexible server.
When you are trying to connect from Azure Data studio what is the error you get can you share the screenshot soi can better assist you?
Regards
Geetha