An error occurred during the pre-login handshake

If you receive the error message:

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.)

It's usually caused by a Certificate Validation issue.

The Microsoft.Data.SqlClient that our tools use to connect to SQL Server has been updated and now defaults to Trust Server Certificate = False in situations where previously defaulted to true.

You can resolve this issue by fixing the underlying Certificate Validation issue which will make using Trust Server Certificate = True when connecting unnecessary or you can work around this be setting Trust Server Certificate = True on the connection strings that our tools use:

SQL Compare and SQL Data Compare

SQL Source Control

SQL Change Automation Powershell

SQL Monitor

SQL Compare and SQL Data Compare


Add ;Trust Server Certificate=true on the Server field on the Data Source tab of the project


Command Line:

Add ;Trust Server Certificate=true on the Server1 or Server2 switch


SQL Source Control

You can set Trust Server Certificate to True in the SQL Server Management Studio's Connection Properties Options

SQL Change Automation Powershell

If using a Powershell script:

You just need to add ;Trust Server Certificate=true to your connection string, for example:

Invoke-DatabaseBuild -InputObject $ScriptsFolder -TemporaryDatabase "Server=SQL_Server;Trust Server Certificate=true;Database=Temp_DB"

If using an addon:

Check the Trust Server Certificate check box


SQL Monitor

You need to enable the Trust Server Checkbox in the Connection Properties of the monitored server



Was this article helpful?

9 out of 21 found this helpful
Have more questions? Submit a request