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.

Thanks,
Soren

2 comments:

Ada Smith said...

I did not believe in all this nonsense from online casinos or any slot machines before but when I got to this site neat the best online casino it became all very interesting to me I figured out what was happening and started playing at all in the slot, slot machines, and all that is there and literally in a week I brought my first money without any problems

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