HTTPS Statement to Powershell

I want to automate running of an application, and got the suggestion of using a curl statement with username/password and to use task scheduling.

As an alternative, I want to use Azure Automation, and then need a corresponding HTTPS statement.

Is that possible, and what is then the correct format for including username and password in the header?

What kind of application does it concern? Running an application module on Invantive Cloud (Invantive App Online)?

If so, the curl statement can be projected 1:1 as HTTPS GET or POST request.

What problem do you run into using the request?

Can you explain the relationship to Powershell?

Can you share the HTTPS request (excluding user name/password)?

What is the code of the module?

When it concerns another Invantive product, please elaborate.

I want to have a schedule running an Invantive Cloud App made with assistance from Invantive to synchronize data to Azure SQL. Firstly, I have a curl that works, but I do not have a server to schedule it on. Thus I was recommended Azure Automation and runbooks, which is a cloud PowerShell in essence.

The Curl working is:

curl --user <username:password> https://<invantive cloud-app url>

I then set up the following powershell:

$username = "username"
$password = "password" | ConvertTo-SecureString -asPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($username,$password)
$res = Invoke-WebRequest -Uri "<URL>" -Credential $cred -UseBasicParsing

This works fine for small data transfers, but when I do the larger tables, the script runs for about 15 minutes and then stops with the following error message:

Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a receive. At line:4 char:8 + $res = Invoke-WebRequest -Uri " … + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Any suggestions to what can be wrong?

First hunch is a time-out.

The use of Invoke-WebRequest can be combined with a time-out. However, none is present and the default is 0 (indefinite) according to the PowerShell documentation at Invoke-WebRequest (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Docs.

So a time-out is unlikely.

Alternatively, the Invantive App Online server can have closed the connection. Maximum runtime for a request on Invantive App Online and Invantive Bridge Online is 6 hours, but something may have a caused an earlier end.

The easiest to analyze this is to visit Invantive App Online Monitoring at It displays all requests of the last 8 hours. Find your request and click on it to view the details (more information on More insight with new Bridge Online Monitoring).

Is there an error code or exception listed in the details?

Do the individual steps at the end provide a hint?

Is it possible to (anonymized) include a full screenshot of the details in Invantive App Online Monitoring in your answer?


See screenshot below:


From my Azure-people I`m asked whether it is possible to get a “202 ACCEPTED” back as a response when the job starts?