I have 5 parameters {[string]$VMName, [string]$ResourceGroupName, [string]$UserName, [string]$Paswd, [string]$UserDirectory, [string]$RequestType} in my runbook code what will be Webhookdata input parameter(json) syntax in Azure ?
Asked
Active
Viewed 891 times
1 Answers
0
if you want to pass Json object to the runbook you need to follow the below steps :
You need to create a JSON file that contains all parameters & save it as test.json file.
{ "VMName" : "", "ResourceGroupName" : "", "UserName" : "", "Paswd" : "", "UserDirectory" : "", "RequestType" : "" }
convert the JSON code to a string
$json = (Get-content -path 'JsonPath\test.json' -Raw) | Out-string
Convert the string to a PowerShell object before passing it to the runbook.
$JsonParams = @{"json"=$json}
Create a hash table for the parameters
$RBParams = @{
AutomationAccountName = '<AutomationAccountName'
ResourceGroupName = '<resourcegroup_name>'
Name = 'Test-Json'
Parameters = $JsonParams
}
- Start the run book
$job = Start-AzAutomationRunbook @RBParams
For more information you can refer this documentation.

VenkateshDodda
- 4,723
- 1
- 3
- 12