"The chain of certificates was issued by an authorized body that is not trusted" when connecting a database in the role of VM from the Azure website

I am experiencing an error connecting MY DB, which is in the role of a virtual machine (I have the role of SQL virtual machine) from the Azure website. VM Role and the Azure site are located in the western zone. I am facing the following problem:

SqlException (0x80131904): A connection to the server was successfully established, but then an error occurred during the login process. (provider: SSL provider, error: 0 - the certificate chain was issued by a trusted authority).]

I can connect to my DB using SSMS. 1433 port is open on my role as VM. What is wrong with my connection?

+155
azure-web-roles azure-vm-role
Jul 12 '13 at 12:46 on
source share
7 answers

Most likely, the trusted root storage of SQL virtual machines does not have a CA certificate installed.

If the connection string has Encrypt=True , either disable it (not recommended) or add the following to the connection string:

 TrustServerCertificate=True 

SQL Server will create a self-signed certificate if you do not install it for use, but the caller will not trust it, because it is not signed by CA, unless you tell the connection string to trust any server certificate by default.

In the long run, I would recommend using Let Encrypt to get a signed CA certificate from a well-known trusted CA and install it on a VM for free. Remember to configure it to automatically update. You can read more about this topic in SQL Server books on the Internet on the topics “Encryption Hierarchy” and “Using Encryption Without Verification”.

+316
Jul 15 '13 at 16:11
source share

If you're using SQL Management Studio, please goto connection properties and click on "Trust server certificated" If you use SQL Management Studio, go to the connection properties and click on "Certified Trust Server"

+46
May 24 '18 at 8:30
source share

If you see this error message when you try to connect using TrustServerCertificate=True , add TrustServerCertificate=True to the additional connection parameters.

+29
May 01 '17 at 5:01
source share

If you are trying to access it through Data Connections in Visual Studio 2015 and get the above error, then go to Advanced and set TrustServerCertificate=True so that the error disappears.

+4
Aug 10 '16 at 1:50
source share

The same can be done from the ssms client itself. Just open ssms, insert the server name, and then from the parameters in the header properties, make sure that the Trust server certificate is verified.

0
May 10 '18 at 9:32
source share

I ran into this error while trying to start the profiler, even if a trusted server certificate was verified on my connection, and I added TrustServerCertificate=True to the extended section. I switched to an SSMS instance running as administrator and the profiler started without any problems. (Earlier, I discovered that when my connections, even local ones, took a lot of time, the launch with administrator privileges helped).

0
Jun 28 '18 at 15:24
source share

I got this problem when importing Excel data into SQL database via SSMS. The solution is to set TrustServerCertificate = True in the security section

0
Dec 09 '18 at 8:53
source share



All Articles