Skip to content

Instantly share code, notes, and snippets.

@mattbalzan
Last active January 6, 2025 11:01
Show Gist options
  • Save mattbalzan/363293cabf54455ef3036a2875634b44 to your computer and use it in GitHub Desktop.
Save mattbalzan/363293cabf54455ef3036a2875634b44 to your computer and use it in GitHub Desktop.
Invoke Azure Runbook Webhook
# --[ Invoke Azure Runbook Webhook ]
# --[ Matt Balzan | mattGPT.co.uk ]
# --[ Set Variables ]
$webhookURI = "https:\\<webhook-URI>"
# --[ Parameters for Webhook ]
$params = @{
param1 = "deviceName"
param2 = "userName"
}
# --[ Create BODY and POST webhook ]
$body = ConvertTo-Json -InputObject $params
$response = Invoke-WebRequest -Method Post -Uri $webhookURI -Body $body -UseBasicParsing
$response
# --[ End of script ]
<# - the section below goes into your Runbook header script.
param
(
[Parameter(Mandatory = $false)]
[object] $WebhookData
)
$Inputs = ConvertFrom-Json $webhookdata.RequestBody
Write-Output "Parameter1 = $($Inputs.param1)"
Write-Output "Parameter2 = $($Inputs.param2)"
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment