Azure Powershell Runbook Unable to Parse Webhook Data

BrianVpl 0 Reputation points
2025-03-19T03:09:00.5766667+00:00

Hi Folks,
I've been trying to get a script to run, as a pre-event for Azure Update Manager. I've got it to run and do various things, but I am having serious issues getting it to parse the webhook correctly.

Using Powershell 7.2 (was using 7.1 until yesterday), running on HybridWorker.

The confusing part, is that in the Testing Pane, it works.

I found examples of the webhooks called in my history, and used those in the test pane, those worked.

But then when called during an update, the webhook parsing fails; erroring about unexpected characters, or empty index.

This is the snipped I copied from the Examples i found for (various) runbook tasks.
Leaving it like this (which works in the test pane): errors out "unexpected Json character H"

I tried removing "convertfrom-json", but when that ran via webhook, it errored out as "$eventType index[0] $null"

i had another, i've lost the notes now, where I exported each variable one at a time, and when it converted from json, it would add "@" at the beggining of the body, and that would cause another "unexpected character".


param 
( 
    [Parameter(Mandatory=$false)] 
    [object] $WebhookData 
) 
$notificationPayload = $WebhookData | ConvertFrom-Json
$notificationPayload = $notificationPayload.RequestBody | ConvertFrom-Json
$eventType = $notificationPayload[0].eventType 

Is there a simple thing i'm missing here, difference between Test Pane/real running?
I'm not a powershell veteran, and testing one change a day, between scheduled runs is difficult to say the least!

Thanks!

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nathan Matchett 0 Reputation points
    2025-08-28T07:52:04.1633333+00:00

    Did you solve this?? having the same issue

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.