I followed the documentation:
https://learn.microsoft.com/en-us/sql/linux/quickstart-sql-server-containers-azure?view=sql-server-ver16&tabs=kubectl
to deploy SQL server on AKS. But While connecting to it, getting the below error:
Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : SSL Provider: [error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:self signed certificate].
Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : Client unable to establish connection.
Note: My previous same question was deleted by Azure Community. This is not a good sign.
I had to connect using the -C flag, which according to the documentation of 'sqlcmd' corresponds to trusting the server certificate, but it was a lucky guess cause I have not found any documentation that indicated it is the correct way to proceed in this scenario.
user@pc_name:~/Desktop$ sqlcmd -?
It seems the problem is with the certificate. With ODBC driver 18.0, the default value for the Encrypt is set to true. I recommend you to read the following blog post.
https://techcommunity.microsoft.com/t5/sql-server-blog/odbc-driver-18-0-for-sql-server-released/ba-p/3169228
Try connecting the SQL Server instance by specifying no encryption. see the following part from the documentation that may help you.
The action item if you are affected by the Encrypt change is to either (in order of recommendation):
Install a trusted certificate on your server.
Change your client's Encrypt connection string setting (or connection property) to optional/no.
If you are using a self-signed certificate and the Force Encryption setting on the server to ensure clients connect with encryption, you will need to do one of the following (in order of recommendation):
Change to a certificate that is trusted as part of the client's trust chain.
Add the self-signed certificate as a trusted certificate on the client.
Change your client's TrustServerCertificate connection string setting (or connection property) to yes.
Refer: https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-use-utility?view=sql-server-ver16