I know this is a popular question. I have tried everything suggested in similar threads. I am trying to connect remotely to a postgresql database on an azure windows server 2012 machine. I have tried the following...
postgresql.conf
listen_addresses = '*'
pg_hba.conf
# IPv4 local connections:
host all all 0.0.0.0/0 md5
Firewall
New inbound rule (firewall) protocols and ports > protocol type > TCP
Local port > 5432 Remote port > All
Grab IP of remote machine
I copied from azure dashboard and also as indicated on top of remote desktop connection
CMD from local machine
Then from local machine tried the following.
psql -U postgres -h 13.xx.xx.xx
Error message.
psql: could not connect to server: Connection timed out (0x0000274C/10060) Is the server running on host "13.xx.xx.xx" and accepting TCP/IP connections on port 5432?
I am not sure what else should be done.



listen_addressesandpg_hba.confsettings, did you restart Postgres? The pg_hba.conf changes only require a reload, but thelisten_addresseschange requires a restart. You can verify the change from Postgres by runningselect current_setting('listen_addresses');You can check your pg_hba settings viaselect * from pg_catalog.pg_hba_file_rules();(if Azure is using PG10 that is) - bma