Created
July 30, 2018 00:43
-
-
Save MatthewJDavis/4598eef65dfb370fb0e1d2306fe03d4d to your computer and use it in GitHub Desktop.
PowerShell runbook for Azure automation webhook example
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
| <# | |
| Script to demo how to get data from a posted webhook | |
| #> | |
| Param | |
| ( | |
| [object]$WebhookData | |
| ) | |
| if ($WebhookData) { | |
| # If section for testing providing webhook data via the Azure portal | |
| if (-Not $WebhookData.RequestBody) { | |
| Write-Output 'No request body from test pane' | |
| $WebhookData = (ConvertFrom-JSON -InputObject $WebhookData) | |
| Write-Output "WebhookData = $WebhookData" | |
| $data = (ConvertFrom-JSON -InputObject $WebhookData.RequestBody) | |
| Write-Output "Service = $($data.Service)" | |
| Write-Output "Host = $($data.Host)" | |
| Return | |
| } | |
| $request = (ConvertFrom-JSON -InputObject $WebhookData.RequestBody) | |
| $data = (ConvertFrom-JSON -InputObject $request.RequestBody) | |
| Write-Output "Service = $($data.Service)" | |
| Write-Output "Host = $($data.Host)" | |
| } | |
| Else { | |
| Write-Output 'No data received' | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment