azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

get-AzureRmAutomationScheduledRunbook Parameters are blank

Open crshnbrn66 opened this issue 10 years ago • 9 comments

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

crshnbrn66 avatar Apr 29 '16 21:04 crshnbrn66

This has happened to me as well.

dawilliams avatar Jul 12 '16 12:07 dawilliams

I'm still seeing this in AzureRM.Automation 3.1.0 - is there any update?

hoppyluke avatar Jun 29 '17 11:06 hoppyluke

Still seeing this on version 3.2.1, parameters are visible in the portal but not returned by running: Get-AzureRmAutomationScheduledRunbook

MatthewJDavis avatar Aug 06 '17 16:08 MatthewJDavis

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

jwefers avatar Jan 22 '18 10:01 jwefers

@vrdmr Can you take a look at this issue and close if it is fixed in the current version of AzureRM

maddieclayton avatar Mar 10 '18 00:03 maddieclayton

Any further updates on this? I do have the same requirement and blocked now. Any help would be really appreciated.

balasbm avatar Mar 31 '18 20:03 balasbm

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 [-ResourceGroupName] [-AutomationAccountName]

balasbm avatar Apr 03 '18 21:04 balasbm

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

safeermohammed avatar Apr 04 '18 22:04 safeermohammed

Closing as will not fix, as this is part of the design.

maddieclayton avatar Apr 04 '18 22:04 maddieclayton