cookie1986
cookie1986

Reputation: 895

How to connect PG Admin to PostgreSQL on Azure?

I am looking to connect my existing PostgreSQL instance on Azure to PG-Admin. Following the advice here, however I get a Unable to connect to server: could not translate host name error. To the best of my knowledge, the host name should be correct. I am taking it from the overview page on Azure, and can confirm it follows the right format of "servername.postgres.database.azure.com". I have also confirmed that that password and usernames are correct, and SSL Mode is set to require (see screenshot, with dummy variables).

enter image description here

In addition, I have tried this on a seperate database in Azure with the same result. No doubt its a mistake I'm making with the hostname/address field in PG-Admin, but I've no idea how to correct.

Upvotes: 0

Views: 1509

Answers (1)

Swarna Anipindi
Swarna Anipindi

Reputation: 954

Prerequisites for connecting PostgreSQL server

  1. Connectivity method: public if we allow for all traffic, private if we restrict traffic via VNet.
  2. Add the IP address where PgAdmin4 is running to the firewall rule.

Step1: Created a new PostgreSQL server enter image description here

Step2: Updated network firewall setting as fallows and saved enter image description here

Verification from PgAdmin4

Step1: copy the server's name, user and password from the server setting enter image description here

Step2: Open PgAdmin4 portal and click on register server information enter image description here

On General Tab, enter - Name: "Any Name" enter image description here

On Connection Tab:

  • HostName : "Server Name from the portal"
  • User Name: "Server admin login name from portal"
  • Password: "Enter Admin Password"
  • Database: "Enter DB name else keep same name"

enter image description here

On SSL Tab:

  • Keep SSL Mode as "Require" and click on SAVE enter image description here

Upon Save. enter image description here

NOTE: Make sure firewall should allow and SSL should be Require.

Upvotes: 2

Related Questions