Azure Database for PostgreSQL flexible server: password authentication failed - Mailing list pgsql-general

From Alexander Farber
Subject Azure Database for PostgreSQL flexible server: password authentication failed
Date
Msg-id CAADeyWjTfKCyDusy1biPAWmhJWh+9hSNrm219uV7UM7UnmaJ8Q@mail.gmail.com
Whole thread Raw
Responses Re: Azure Database for PostgreSQL flexible server: password authentication failed
List pgsql-general
Good afternoon,

I am using an Azure Database for PostgreSQL flexible server with no public ip.

It is connected to a private VNet and I try to access it from an Alpine Linux container with openssl and postgresql-client installed.

In Azure portal I have clicked the "Reset password" button, entered twice password12345!! and received the web browser notification
"Successfully reset the password for postgresql"

Then I run the commands:

$ openssl s_client -connect 172.21.32.4:5432 -starttls postgres
(then after some time)
2C820000:error:8000274C:system library:BIO_connect:Unknown error:../openssl-3.2.3/crypto/bio/bio_sock2.c:178:calling connect()
2C820000:error:10000067:BIO routines:BIO_connect:connect error:../openssl-3.2.3/crypto/bio/bio_sock2.c:180:
connect:errno=0

$ PGPASSWORD="password12345!!" psql "postgresql://postgres:password12345!!@172.21.32.4:5432/postgres?sslmode=require"
psql: error: connection to server at "172.21.32.4", port 5432 failed: FATAL:  password authentication failed for user "postgres"

In the server logs I see entries for some other connections:

2025-02-28 14:39:35 UTC-67c1ca93.50ee-LOG:  disconnection: session time: 0:00:20.024 user=azuresu database=postgres host=169.254.128.1 port=53076
2025-02-28 14:39:36 UTC-67c1caa8.5146-LOG:  connection received: host=169.254.128.1 port=49016
2025-02-28 14:39:36 UTC-67c1caa8.5146-LOG:  connection authenticated: identity=\"CN=azuresu.c1fba9900d4d.database.azure.com\" method=cert (/datadrive/pg/data/pg_hba.conf:17)
2025-02-28 14:39:36 UTC-67c1caa8.5146-LOG:  connection authorized: user=azuresu database=postgres SSL enabled (protocol=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384, bits=256)

I do not see any logs related to my unsuccessful tries.

In the "Server parameters" I have set the parameters:

log_connections ON
log_hostname ON
log_statement MOD
max_connections 500
ssl ON (cannot change that one)
listen_address '*' (cannot change that one)

And currently I am stuck, wonder how do others debug such problems?

Best regards
Alex

pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: Long Running query and trace potential issues
Next
From: Alexander Farber
Date:
Subject: Re: Azure Database for PostgreSQL flexible server: password authentication failed