I am new to Azure Automation. I want to call a URL and get its HTML once every weekday morning. This is what I have written so far.
workflow Wakeup-Url
{
Param
(
[parameter(Mandatory=$true)]
[String]
$Url
)
$day = (Get-Date).DayOfWeek
if ($day -eq 'Saturday' -or $day -eq 'Sunday'){
exit
}
$output = ""
InlineScript {"$Using:output = (New-Object System.Net.WebClient).DownloadString(`"$Using:Url`");"}
write-output $output
}
Its not giving me the HTML in the output when I test the runbook. Instead what I get in the output pane is:
= (New-Object System.Net.WebClient).DownloadString("https://my.url.com/abc.html");
Your InlineScript is currently just outputting a string containing your script, since you put quotes around the entire expression:
This is what you want I think:
This should be a more simple approach than using the Webclient
$output = (Invoke-WebRequest -Uri http://www.google.com -UseBasicParsing).Content
I'm using Azure Runbook scheduler. I used code below to trigger an URL call.
Source: https://sharepointyankee.com/2018/01/29/creating-runbooks-in-azure-and-calling-them-from-sharepoint-using-webhooks-and-flow/