Last active
January 6, 2025 11:01
-
-
Save mattbalzan/363293cabf54455ef3036a2875634b44 to your computer and use it in GitHub Desktop.
Invoke Azure Runbook Webhook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --[ 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