get-AzureRmAutomationScheduledRunbook Parameters are blank
after scheduling a run book and then attempting to get back the passed parameters. The value for the parameters are blank
get-AzureRmAutomationScheduledRunbook -RunbookName check4alerts -ScheduleName check4alertsadhoc -ResourceGroupName $resoureGroupName -AutomationAccountName $AutomationAccountName
ResourceGroupName : AzureTesting AutomationAccountName : AutomationAccountTest JobScheduleId : xx RunbookName : check4Alerts ScheduleName : Check4AlertsAdhoc Parameters : {}
For this schedule I put the params in the GUI
This has happened to me as well.
I'm still seeing this in AzureRM.Automation 3.1.0 - is there any update?
Still seeing this on version 3.2.1, parameters are visible in the portal but not returned by running: Get-AzureRmAutomationScheduledRunbook
I have insight on this, when you run the commands with -Debug:
First, when you do sth like get-azurermautomationaccount | get-AzureRmAutomationScheduledRunbook, which might return multiple schedule links, parameter objects always seems to be empty (coming from REST API).
However, when you, as you did, request a specific ScheduledRunbook, The Debug shows the following:
Body:
{
"id":
"/subscriptions/REDACTED/resourceGroups/REDACTED/providers/Microsoft.Autom
ation/automationAccounts/REDACTED/jobSchedules/REDACTED",
"properties": {
"jobScheduleId": "REDACTED",
"runbook": {
"name": "REDACTED"
},
"schedule": {
"name": "testsched"
},
"runOn": null,
"parameters": {
"param1": "\"a\"",
"param2": "\"s\"",
"param3": "\"s\""
}
}
}
as you can see, the parameter object values contain additional enquoted double quotes. I suspect these should not be there, but they are, regardless whether i created the RunbookSchedule via Portal or via Register-AzureRmAutomationScheduledRunbook.
This might be a bug in Azure Automation REST API, but in addition, enquoted double quotes should not disturb the JSON parser which the cmdlet uses.
Anyhow, the rest api return shows correct parameters but the resulting powershell object still has Parameters == $null
@vrdmr Can you take a look at this issue and close if it is fixed in the current version of AzureRM
Any further updates on this? I do have the same requirement and blocked now. Any help would be really appreciated.
Alright I found the solution for this. You need to get the JobScheduleId and the pass it to the below cmdlets will get the parameter values nicely!
Get-AzureRmAutomationScheduledRunbook -JobScheduleId
In collections we do not return parameters (due to perf limitation). Please pass JobScheduleId to get the full response. Alternatively this can be done to retrieve full payload Get-AzureRmAutomationScheduledRunbook [-ResourceGroupName] [-AutomationAccountName] | Get-AzureRmAutomationScheduledRunbook
Closing as will not fix, as this is part of the design.