I've created a Azure Database for PostgreSQL flexible servers inside a virtual network, with a dedicated subnet for the database set to flexible servers. I've got a Private DNS Zone as well with an A record pointing to the database and a virtual network link setup. However, I can't connect to the database by the Azure Bash terminal.
I've tried using "host .postgres.database.azure.com" and I get this response: Error message from bash terminal
Has anyone encountered this before, or potentially knows how to solve this?
This has happened after following the default steps to create the private database in the vnet.
I created Azure Database for PostgreSQL flexible servers with virtual network like below:
This error usually occurs if the hostname for the database is not being resolved correctly. Check if you are using the correct hostname to connect to your server.
In private dns zone added A record and ensure that virtual network links is completed:
Now create linux virtual machine with same virtual network and Authentication type username and password and connect to hostname like below:
Now you need to install the postgresql-client tool to be able to connect to the server.
Connect to the server in your Azure Database for PostgreSQL flexible servers under setting, connect and use that command connect from browser or locally like below:
When I try to connect with the above command, got result successfully like below: