SSL error: certificate verify failed when using psql connect the Azure PostgreSQL - Flexible Server

Moary Chen (CSI Interfusion Inc) 20 Reputation points Microsoft Vendor
2024-09-18T07:58:13.5233333+00:00

Hi team,

I am trying to use Azure Database for PostgreSQL - Flexible Server within a private VNET, I followed the doc Connect using psql to test the connectivity using ssl mode is verify-full, the used certificate file DigiCertGlobalRootCA.crt.pem is downloaded from this link in the section Download root CA certificates , and it's converted to pem format through the tool openssl.

When execute the command, I found the below exception:

SSL error: certificate verify failed

Could you help to provide any doc to troubleshoot the root cause? See more from the original GitHub issue.

Azure Database for PostgreSQL
{count} votes

Accepted answer
  1. Sai Raghunadh M 1,045 Reputation points Microsoft Vendor
    2024-09-20T09:51:21.39+00:00

    Hi @Moary Chen (CSI Interfusion Inc),

    The %APPDATA%\postgresql\root.crt file is created automatically when you install PostgreSQL on your machine

    As you said that there is no %APPDATA%\postgresql\root.crt. you can create the path manually.

    Here are the steps for creating the path:

    1.) Open Notepad.

    2.) Open the Run dialog:

    • Press Win + R, type %APPDATA%, and hit Enter.
    • Create the PostgreSQL folder (if it doesn't exist):
    • Right-click, select New > Folder, and name it postgresql.

    3.) Create the Data folder:

    • Inside the postgresql folder, right-click, select New > Folder, and name it data.

    4.) Move root.crt:

    • Place the root.crt file into the %APPDATA%\postgresql\data folder.

    Your root.crt is now in %APPDATA%\postgresql\data, and certificate verification will work. I hope this information helps, please do let us know if you have any Queries.

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.