Powershell Invoke-WebRequest could not create ssl/tls secure channel when tls is upgrade to tls1.3

50 views Asked by At

there is a powershell script running as a remote process on uDeploy, below is the script:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri https://xxx/api/health

it was working fine until the service of this api (running on openshift) is using tls1.3, then I have to remove

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

but still got the error Could not create SSL/TLS secure channel then I had to copy this script to my local environment which has .net 5 and .net framework 4.8 installed and the script can perfectly work without adding something like:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls13

Can I assume that .net framework 4.8 doesn't support tls1.3 but .net 5 does?

So the question is, is there a way to Invoke-WebRequest using .net framework 4.8 to a tls1.3 service? BTW, I know there could be a way by editing the Registry and enable tls1.3, but this is forbidden in our environment

Added windows versions for both my local environment that can run the script:

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      19042  0    

And the remote environment on uDeploy services that cannot run the script:

Major  Minor  Build  Revision
-----  -----  -----  --------
6      3      9600   0  
0

There are 0 answers