When I connect to our SQL Server via SimplySQL 1.9.0 or 1.9.1, it works fine, regardless of my connection string. When I run the exact same script but specify the use of SimplySQL version 2.0.2.70 or 2.0.4.75, if I don't add "TrustServerCertificate=true;", I get:
Open-SQLConnection: V:\KWeinrich\Storage\Create-AllServerCountReport.ps1:485
Line |
485 | Open-SqlConnection -ConnectionName 'SS' -ConnectionString $conn # …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 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.)
Here is my simple connection string:
SS connection open Server=XYZ;Database=StorageReporting;Integrated Security=SSPI;
Pwsh.exe version 7.4.3
PS V:\KWeinrich\KW-CheckAllServers> get-installedmodule simplysql -allversions
Version Name Repository Description
------- ---- ---------- -----------
1.9.1 SimplySql PSGallery Querying SQL (SQL Server, Oracle, Postgr…
2.0.2.70 SimplySql PSGallery Querying SQL (SQL Server, Oracle, Postgr…
2.0.4.75 SimplySql PSGallery Querying SQL (SQL Server, Oracle, Postgr…
But, if I add TrustServerCertificate=true; to the connection string, yielding:
Server=V26267NCPK609;Database=StorageReporting;Integrated Security=SSPI;TrustServerCertificate=true;
Then it works regardless of SimplySQL version. But I would rather not specify TrustServerCertificate = true - I'd rather it check and verify the cert.
When I connect to our SQL Server via SimplySQL 1.9.0 or 1.9.1, it works fine, regardless of my connection string. When I run the exact same script but specify the use of SimplySQL version 2.0.2.70 or 2.0.4.75, if I don't add "TrustServerCertificate=true;", I get:
Here is my simple connection string:
Pwsh.exe version 7.4.3
But, if I add TrustServerCertificate=true; to the connection string, yielding:
Then it works regardless of SimplySQL version. But I would rather not specify TrustServerCertificate = true - I'd rather it check and verify the cert.