Database Connect activity fails with: The certificate chain was issued by an authority that is not trusted

Customer facing issue while establishing connection to database server with error as "Connect: A connection was successfully established with the server, but then an error occurred during the login process. (Provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)"

Issue Description

After migrating to the Windows compatibility project from Windows - Legacy, the following error occurs when trying to connect to the Database server using Studio activities:

"Connect: A connection was successfully established with the server, but then an error occurred during the login process. (Provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)"

Resolution

  1. Validate the certificate that is being used by the SQL server:
    • Open SQL Server Configuration Manager on the SQL server.

    • Expand SQL Server Network Configuration in the left pane, right-click on Protocols for MSSQLSERVER, and click on Properties.

    • In the Properties window, navigate to the Certificate tab and gather the certificate details by clicking on View... (make sure to save the thumbprint for unique identification)

  1. Export the Certificate:
    • Open Run on the SQL server, and type in certlm.msc and press enter. This will open the Local Machine Certificate Manager.

    • Locate the certificate viewed in the Validating certificate step, in the Personal Store, open it and verify the thumbprint.
    • Right-click on the certificate, select All Tasks->Export.

    • Save the Certificate to a local path.

  1. Copy the Certificate to the Client Certificate Stores:
    • Next, copy the certificate to the Robot machine's file system.
    • Open Run on the Windows server, and type in certlm.msc and press Enter. This will open the Local Machine Certificate Manager.

    • Once the window has opened, navigate to Personal->Certificates, right-click on the empty space, select All Tasks->Import...

    • Perform the steps in the Certificate Import Wizard to import the certificate of your choice.
    • Repeat the above steps for the Trusted Root Certification Authorities->Certificates.
    • Repeat the above on all Robot machines where you want to connect with the database.

Root Cause

The issue had been occurring because the certificate that was being used by the SQL server was not trusted by the Robot machine.