While using the "Run Script" operator to execute Invoke-RestMethod it generates/returns the following error:
Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.At line:1 char:13+ $response = Invoke-RestMethod 'https://url/path/to/endpoint...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException+ FullyQualifiedErrorId : WebCmdletWebResponseException.Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Release : 4.3
Component : Process Automation
This can happen due to Powershell defaults and the need to enforce TLS1.2.
Add the following to the "Run Script" .ps1 script being run - prior to the Invoke-RestMethod cmdlet:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12