I am trying to replicate an example which I found in order to know a little about the azure operation. But I think I have a problem when using variables, to get the data that should be received.
The example is as follows: example link
The code they use in the example is:
runbook
param (
[object]$WebhookData
)
if ($WebhookData -ne $null)
{
$BodyContent = $WebhookData.RequestBody
Write-Output "There was a tweet from $BodyContent"
}
else
{
Write-Error "Something went wrong buddy"
}
webhook
$Credential = Get-Credential
#Authenticate to Azure and AzureRM
Add-AzureAccount -Credential $Credential | Out-Null
Add-AzureRmAccount -Credential $Credential | Out-Null
#Provide the necessary information for your environment
$Webhook = New-AzureRmAutomationWebhook '
-Name "TriggeredByTwitter"'
-RunbookName "Hello-Twitter"'
-IsEnabled 1 '
-ExpiryTime (Get-Date).AddDays(10)'
-ResourceGroupName "Automation"'
-AutomationAccountName "AutomationAccount"
#Print the webhook uri
Write-Host $Webhook.WebhookUri -ForegroundColor Green
In my case I use the azure GUI to create the webhook , it makes me comfortable since I know practically nothing.