That indicates that you are using encrypted communication to SQL (which is now the default) but the cert being used isn't trusted. This is common if you have not configured your SQL Server to use a custom certificate. The generated certificate is self service and not valid across machines. To work around this change your connection string to allow any cert from the server. It generally looks something like this: Server=SomeServer;Database=SomeDatabase;Encrypt=True;TrustServerCertificate=True
Now you can connect encrypted using the server's own cert. If you are getting this while trying to connect using the UI (or SSMS) then go to the connection options and you'll see the Trust Server Certificate
checkbox that you need to check.
In visual studio I get a message regarding SQL connection
Since a couple of days, I receive this error from Visual Studio, can somebody helps me to correct the situation: A connection was successfully established with the server, but then an error occurred during the login process. (provide: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.) Clude from Quebec, Canada
2 answers
Sort by: Most helpful
-
Michael Taylor 54,646 Reputation points
2024-01-17T19:22:23.55+00:00 -
ZoeHui-MSFT 37,221 Reputation points
2024-01-18T05:42:59.7766667+00:00 Hi @Claude Larocque,
While setting
TrustServerCertificate=True
orEncrypt=false
in the connection string is a quick fix, the recommended way of solving this issue is to provide a proper certificate for your SQL Server from a trusted CA.A same thread here you may take a reference to.
Regards,
Zoe Hui
If the answer is helpful, please click "Accept Answer" and upvote it.