Subtitle – How do I actually connect to SQL Azure securely without Man in the middle attacks?
I can use a ADO.net connection string with TrustServerCertificate=true and connect to the server successfully. But by doing that I would lose protection against a man-in-the-middle attack where the communication with the server is hijacked, and an unknown certificate is used to establish the connection. So I want to use TrustServerCertificate=false.
The only problem is, now I get the error that the connection fails trust validation. I expect the solution to this is that I need to install the SQL Azure’s server certificate in one of my certificate stores. The problem is I have no idea how to get the server certificate. Help?
To validate the certificate in the ADO.Net world you need to have
Encrypt=TrueandTrustServerCertificate=Falsefor it to work. Did you haveEncrypt=Truein your orginal scenario?A good read on SQL Azure security can be found on the wiki below:
http://social.technet.microsoft.com/wiki/contents/articles/sql-azure-connection-security.aspx