Not able to run the Azure functions app locally on Windows 11 due to TLS enforcement

313 views Asked by At

I recently updated my system to Windows 11. I am no longer able to run my Azure functions api locally using VSCode due to the Handshake Failure error.

Error is below:

> [2023-10-19T10:23:15.097Z] Error building configuration in an external startup class.
> [2023-10-19T10:23:15.104Z] Error building configuration in an external startup class. System.Net.Http: The SSL connection could not be established, see inner exception. System.Net.Security: Authentication failed because the remote party sent a TLS alert: 'HandshakeFailure'. The message received was unexpected or badly formatted.
> [2023-10-19T10:23:15.263Z] A host error has occurred during startup operation '30896d42-9414-42f4-a910-c6e212cddec7'.
> [2023-10-19T10:23:15.268Z] Microsoft.Azure.WebJobs.Script: Error building configuration in an external startup class. System.Net.Http: The SSL connection could not be established, see inner exception. System.Net.Security: Authentication failed because the remote party sent a TLS alert: 'HandshakeFailure'. The message received was unexpected or badly formatted.
> Value cannot be null. (Parameter 'provider')

Upon investigation I found that the default TLS Version in Windows 11 is TLS1.3.

But while debugging locally using local emulator option, the Azure functions connects to a CDN(functionscdn.azureedge.net),

"AzureWebJobsStorage": "UseDevelopmentStorage=true"

As per Microsoft all Azure services expect TLS1.2 including this CDN(Link to the article).

Is it possible to force the VSCode to use TLS1.2? I do not want to enable the How do I resolve this issue?

Note: Currently running fiddler alongside is fixing things as the traffic is tunneling through fiddler and fiddler is using TLS1.2.

I have tried setting the TLS version using powershell with no luck, [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;

1

There are 1 answers

0
Pravallika KV On

Select both TLS 1.2 and 1.3 version in your Windows 11 system:

  • Go to Search bar=> Search for Internet Options=> navigate to Advanced=> Select TLS 1.2 and 1.3 in the displayed options.

enter image description here

  • Try upgrading Azure function core tools version:
npm i -g azure-functions-core-tools --unsafe-perm true

enter image description here

  • If this does not work, try updating your Azure Functions runtime to the latest version, which supports your TLS version.

I have Windows 11 and the followed above mentioned steps. I can successfully run the Azure function without any issues:

enter image description here