Skip to content

[Feature]: GetAzureAutomationScheduledRunbook fails when schedule has credential parameters #28525

@tpgygyalarm

Description

@tpgygyalarm

Description of the new feature

Cmdlet(s)
Get-AzureRmAutomationScheduledRunbook

PowerShell Version
Name Value


PSVersion 5.1.15063.138
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.138
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Module Version
Get-Module reports version of AzureRM.Automation is 2.7

OS Version
10.0.15063.138

Description
azureautomation/runbooks#14 because the Automation Team's script was failing on Get-AzureRmAutomationScheduledRunbook when the schedule had a Credential object associated with it.

The exception:

Get-AzureRmAutomationScheduledRunbook : Invalid JSON primitive: SqlJobRunner.
At .\ReRegisterAutomationSchedule-MS-Mgmt.ps1:74 char:14

  • ... $sItem = Get-AzureRmAutomationScheduledRunbook -AutomationAccount ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : CloseError: (:) [Get-AzureRmAutomationScheduledRunbook], CmdletInvocationException
    • FullyQualifiedErrorId : Microsoft.Azure.Commands.Automation.Cmdlet.GetAzureAutomationScheduledRunbook
      Debug Output
      The relevant section of the debug output is the JSON body response from the API call:

Body:
{
"id": "/subscriptions/xxx/resourceGroups/ta-automation-rg/providers/Microsoft.Automation/automationAccounts/ta-automation/jobSchedules/xxxx",
"properties": {
"jobScheduleId": "xxx",
"runbook": {
"name": "SQLServerIndexMaintenance"
},
"schedule": {
"name": "ClientTest - Reindexing"
},
"runOn": null,
"parameters": {
"Credential": "SqlJobRunner",
"SqlServerName": ""dbname.database.windows.net""
}
}
}
Script/Steps for Reproduction
Create a runbook that requires a Credential object.
Set up a schedule for that runbook specifying valid credential parameters.
Attempt to call Get-AzureRmAutomationScheduledRunbook using the overload that takes as paramaters AutomationAccount, ResourceGroup, JobScheduleId
Profit.

Proposed implementation details (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions