Tuesday, October 23, 2018

Call Azure Function from Powershell

I was fooling around with Azure Functions and wanted to try calling a Webhook function from Powershell. I just wanted to test a simple function from Powershell

I kept getting an error saying that 'The underlying connection was closed: An unexpected error occurred on a send' when I used Invoke-RestMethod.

Turns out that for some reason, you have to force Powershell  on TLS 1.2

When I ran this command to do that -

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

it worked and I got my 200 OK response.

To reset, you can run this command -

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

Hope this helps anyone out there struggling.


1 comment:

Ada Smith said...

In the evening it happens that sidish is boring in the evening and you don’t know what to do with your desire to chevoto gamble, cool. Found this site swell top 10 online casinos now sitting here all day. Money withdraw easily, cool design. I like everything