I am trying to read the URL query params from a POST coming into my Azure webhook (PowerShell).
My webhook is receiving a POST request such as:
Content-Type: text/plain; charset=utf-8
POST https://{notificationUrl}?validationToken={opaqueTokenCreatedByMicrosoftGraph}
As you may tease out, the context here is the creation of a Microsoft Graph subscription. However, I don't want to muddy up this post with too many details because I think my question is general enough: how to read POST params in an Azure webhook.
The runbook attached to this webhook (based on this one) apparently requires all the client data to come in via a single parameter called WebhookData
. I am able to read the WebhookName
, RequestBody
, and RequestHeader
inside WebhookData
. However, I don't know how to read the URL query parameter in the POST request that is reaching my webhook.
Specifically, I need to access that validationToken
. It doesn't show up in the WebhookData
. I've also tried removing the Webhookdata
param altogether from my runbook, but then absolutely nothing comes in. I've also tried adding a validationToken
param, alongside the WebhookData
param, but validationToken
comes out empty.
I should add that, along with the POST from Graph (which doesn't work), I am testing my runbook with Postman and making sure to include a validationToken
in the URL. Again, I can read it if I include it in the POST body, but not if it's a query param. And since ultimately Graph will be sending it via the query param, I think I have to get that to work first.
Very specifically,
Azure Runbooks
, do not support query strings. From the documentation:Azure Runbooks
has 2 parts to it, triggers and runbooks:The
Runbook
(Right Box) only accepts the singleWebhookData
object to manage variable and data thatAzure Runbooks
will operate with.Webhooks
(Left Box), handles the triggering, receiving of data and passing it on to theRunbook
. Very specifically, theRequestBody
is specified as the:With this definition, very specifically, even though
WebHooks
can support query strings, in this case for triggeringAzure Runbooks
they are explicitly ignored.Aside, if the end desire is to subscribe to Microsoft Graph events, the "better" way is to use
Event Hubs
to handle notifications: