We are using Octopus Deploy to deploy our application. After a successful deployment, we have an additional step of sending a notification to Slack with the deployment status.
However, this previously-working step is started failing a few days ago. I have been so far unable to find the root cause of the failure.
We are getting this error in the Slack log:
Invoke-RestMethod : The request was aborted: Could not create SSL/TLS secure channel.
+ Invoke-RestMethod -Method POST -Body ($payload | ConvertTo-Json - ...
Error
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException+ FullyQualifiedError IdWebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
The remote script failed with exit code 1
Things we've tried so far:
- Verified the TLS version on the server.
- Reviewed a few articles from the Internet to bypass SSL/TLS
Here's the PowerShell script that we are using:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-RestMethod -Method POST -Body ($payload | ConvertTo-Json -Depth 4) -Uri $OctopusParameters['HookUrl'] -ContentType 'application/json'