The following error might occur when attempting to use a SQL or Database connection object in some way that connects to SQL Server:
SQL Server of a certain version requires TrustServerCertificate=true for the connection properties. This can be set on the connection object by:
Now the connection object will test successfully to the database
MS article on this: https://techcommunity.microsoft.com/t5/azure-database-support-blog/pkix-path-building-failed-unable-to-find-valid-certification/ba-p/2591304