• Please check whether the Azure AD Administrator assigned for your PostgreSQL database Server has the role of ‘azure_ad_admin’ in the database roles. Also, please check whether the Azure AD admin is removed from the server or not, because as you said you were not able to login to the Database using the PGAdmin account, thus if the Azure AD Admin account is removed from the server, the server will not be associated with the Azure tenant any longer due to which also AAD authentication might not be possible for your Server.
• Please check whether your PostgreSQL Server is listening to the external interfaces, i.e., whether the communication and accessibility is not blocked by any firewall or NSG or sort of. Also, to sort this problem out of external communication through PostgreSQL DB Server, go to ‘postgresql.conf’ file and execute the below command to modify it: -
sudo vim /etc/postgresql/9.3/main/postgresql.conf
Add the below line in that file: -
listen_addresses = '*'
And then restart the PostgreSQL service through the below command: -
sudo /etc/init.d/postgresql restart
The above commands are with respect to Linux (Ubuntu), for Windows version of local PostgreSQL client, the ‘postgresql.conf’ file can be located at ‘C:\Program Files\PostgreSQL<version>\data’
• Also, I would suggest you to please check the community thread link below for more details regarding fixing your issue: -
Server closes connection unexpectedly when connecting to Azure Postgres
As you are facing persistent connection issues with your PostgreSQL DB Server, most probably, it might be due to incorrect Server and client firewall configuration, a user error while entering the server’s suffix name and its credentials and other general issues too. Please check the documentation link below for detailed information: -
https://learn.microsoft.com/en-us/azure/postgresql/howto-troubleshoot-common-connection-issues#troubleshoot-persistent-errors