ASP.NET Core - A connection was successfully established with the server, but then an error occurred during the pre-login handshake

Add TrustServerCertificate=true to the end of the connection string.