Default SSL/TLS version mismatch between local dev and remote functions
Different versions of the SSL/TLS protocol are enabled by default in local development and functions deployed to Azure.
My organization uses Azure Functions that make calls to other web services. We noticed that in some cases these functions could make HTTPS calls to a particular service when running locally but the HTTPS calls failed when running the Azure Function from Azure. It turns out that one web service we are calling only accepts TLS 1.1 or TLS 1.2. Running the function locally through Visual Studio Azure Function tools, TLS 1.2 was enabled. Running through Azure Functions deployed on Azure TLS 1.1 and 1.2 were disabled.
I have attached a sample function project that demonstrates this issue.
TraceWriter output when run locally: "Default SSL protocols for outbound HTTPS calls: Tls, Tls11, Tls12" TraceWriter output when run on Azure: "Default SSL protocols for outbound HTTPS calls: Ssl3, Tls"
The project I attached is set to target .NET 4.7.
Reprod and +1 for this.
Tls12 should be the default and the rest opt-in if you really need to talk a service that only support earlier versions of Tls. Ssl3 should be completely disabled.
Forcibly setting System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; does work in Azure 💥🔨
Looks same as https://github.com/Azure/azure-webjobs-sdk-script/issues/1639
I am also running into this issue. Why does Azure Function not default to TLS 1.2
I added System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; to my code and it works fine.
Is there a non-code solution? Seems like there should be a setting in Azure Function or something I can change in the host file? Is the code solution the only solution to enable TLS 1.2?
The code based solution is the only option. As discussed in Azure/azure-webjobs-sdk-script#1639 we are not planning on making any further changes here because there is an acceptable workaround for v1 and functions v2 does not have this problem.
Geesh...nothing like finding this after 6:00 PM on a Friday. Thanks for posting! Makes my weekend much better!
Fixed with the GA of Functions v2. Please upgrade to that newer runtime to fix this issue.