Hi Daniel,
Unable to login (with admin account) to private Azure Postgres Flexible Server with EntraID enabled.
psql: error: connection to server at "aaa.postgres.database.azure.com" (10.0.1.4), port 5432 failed: FATAL: password authentication failed for user "xxx"
connection to server at "aaa.postgres.database.azure.com" (10.0.1.4), port 5432 failed: FATAL: no pg_hba.conf entry for host "10.0.0.252", user "xxx", database "postgres", no encryption
To resolve this error, select the Name
from the Authentication
section under Security
in Microsoft Entra Admin, including all extensions. This will fix the issue.
Image
Follow the below steps to log into the DB and perform administrative actions.
Step 1: Create a Virtual Network (VNet)
Image:
Step 2: Create PostgreSQL Server with VNet Integration and AAD Authentication
Image:
Image:2
Steps:3 To Create a VM with Microsoft Image (Windows Server) and Password Authentication
Image:1
Image:2
Install pgAdmin on the VM within the same VNet where the PostgreSQL Flexible Server is integrated.
Step:4 To Generate Azure Access Token
-Log in to Azure using az login
to authenticate your account, then generate an access token with the command az account get-access-token --resource https://management.azure.com
.
Image:
Copy the token from Azure CLI and paste it into pgAdmin on the VM to connect to the server.
Image:1
The Host name/address
should be taken from the Endpoint
in the Azure PostgreSQL Flexible Server overview page.
Image
The Username
should be taken from the PostgreSQL Flexible Server under Security
. Select Authentication
, and on the right side, under Microsoft Entra Admins, choose and copy the Name
, then use it as the Username
in pgAdmin.
Image
By entering the correct username and password in pgAdmin on the VM, you will be able to log into the database and perform administrative tasks.