Unable to access postgres remotely from Azure VM

I'm trying to access a postgres database remotely and I can't for the life of me get it to work.

I've installed a Gen 2 linux VM in Azure with Ubuntu 14.04 and installed postgres. SSH works remotely, and psql works fine while remoted in.

Steps I've taken:

  1. updated postgresql.conf listen_addresses to be '*' and confirmed via psql and show listen_addresses that it's listening to *.

  2. Updated pg_hba.conf by adding host all all 0.0.0.0/0 md5.

  3. Added an inbound allow rule in the Azure Network security group for port 5432. enter image description here

  4. Restarted postgres/ubuntu.

After these steps, I'm able to work with and access psql just fine, but whenever I attempt to remotely connect to the instance via pgAdmin3, I get an error stating that the connection timed out.

Further, when I use a port checker remotely, port 5432 is reported as closed.

What am I missing/doing incorrectly?

Thanks in advance.

Update:

Here is the current output of iptables -S enter image description here


Sounds like you need to use iptables-persistent

See

http://postgresql.freeideas.cz/install-postgresql-9-5-on-ubuntu-14-04/


So, for some reason, this is an Azure issue. I opened port 5432, but that didn't work. In a move of desperation, I've opened 1024-65535, and now I can connect. Clearly I'm missing something related to the usage of inbound rules. While this does fix my issue, it's clearly not a best practice. Any thoughts on what I'm missing?