question

ClaborneDaniel-0370 avatar image
0 Votes"
ClaborneDaniel-0370 asked KalyanChanumolu-MSFT answered

Connecting to postgresql through VPN

I have set up a Postgresql database and am trying to connect with Python/psql through a VPN. I am using the connection string of the form "host=myhost.postgres.database.azure.com port=5432 dbname=postgres user=user password=mypw sslmode=require"

In networking, I whitelist the ip range corresponding to the private network, but cannot connect as I can with an MSSQL-server database using the same whitelist. I get the error:

psql: error: could not connect to server: Operation timed out
Is the server running on host "<hostname>" (<hostip>) and accepting
TCP/IP connections on port 5432?

When disconnecting from the VPN an allowing all ip's I can connect with psql.

I'm not able to follow the language in this post: https://stackoverflow.com/questions/56127851/connect-to-azure-database-for-postgresql-through-vpn but it sounds like there may be no resolution to this?

azure-database-postgresql
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

KalyanChanumolu-MSFT avatar image
0 Votes"
KalyanChanumolu-MSFT answered

@ClaborneDaniel-0370 Thank you for reaching out.

The answer on StackOverflow seems to be old and was posted before Azure Private Link was available.

You can now Configure Private Link for Azure Database for PostgreSQL and Connect from an on-premises environment over VPN
Detailed instructions are provided in the hyperlinks above.

Please let us know if you face any issues or have further questions.


If an answer is helpful, please "Accept answer" or "Up-Vote" which might help other community members reading this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.