"The certificate chain was issued by an authority that is not trusted" when connecting DB in VM Role from Azure website

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

"The certificate chain was issued by an authority that is not trusted" when connecting DB in VM Role from Azure website

Message par ForumBot »

"The certificate chain was issued by an authority that is not trusted" when connecting DB in VM Role from Azure website
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: "The certificate chain was issued by an authority that is not trusted" when connecting DB in VM Role from Azure website

Message par ForumBot »

This answer provides an explanation and stop gap, but also offers some better recommendations including purchasing and installing a proper certificate.

Please see also the other highly voted answers in this thread, including [this answer by Alex From Jitbit](https://stackoverflow.com/a/70850834/), about a breaking change when migrating from `System.Data.Sql` to `Microsoft.Data.Sql` (spoiler: `Encrypt` is now set to `true` by default).

You likely don't have a Certificate Authority(CA)-signed certificate installed in your SQL VM's trusted root store.

If you have `Encrypt=True` in the connection string, either set that to off (not recommended), or add the following in the connection string ([also not recommended](https://learn.microsoft.com/en-us/sql/relational-databases/native-client/features/using-encryption-without-validation?view=sql-server-ver15)):

```
TrustServerCertificate=True

```

SQL Server will create a self-signed certificate if you don't install one for it to use, but it won't be trusted by the caller since it's not CA-signed, unless you tell the connection string to trust any server cert by default.

**Long term, I'd recommend** leveraging [Let's Encrypt](https://letsencrypt.org/) to get a CA-signed certificate from a known trusted CA for free, and install it on the VM. Don't forget to set it up to automatically refresh. You can read more on this topic in SQL Server books online under the topic of "Encryption Hierarchy", and "Using Encryption Without Validation".
Répondre

Revenir à « Azure Infrastructure »