This article applies to inSync Cloud and inSync Gov Cloud
Reporting API fails with one of the following unexpected error messages when using SSLv3 / TLS1.0.
Exception found Creating The Web Request: The underlying connection was closed: An unexpected error occurred on a send.
Invoke-RestMethod: The underlying connection was closed: An unexpected error occurred on a send.
PowerShell and VB.net use TLS 1.0 and SSLv3 for Web requests. SSLv3 and TLS 1.0 were deprecated in a Cloud Push dated September 2, 2017. Hence the Reporting API script no longer works.
For PowerShell, add the following lines in the script to enforce PowerShell to use TLS 1.2:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
For VB.net add the following lines in the script to enforce VB to use TLS 1.2:
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12