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

Register-AzureRmAutomationScheduledRunbook parameters was not input correctly

Open FranckSix opened this issue 9 years ago • 5 comments

Cmdlet(s)

Register-AzureRmAutomationScheduledRunbook

PowerShell Version

5.1.14393.206

OS Version

10.0.14393.206

Description

When I use Register-AzureRmAutomationScheduledRunbook to create a Runbook's cedule parameters in portal contain quotes see file to screenshot. This make my workbook to fail.

capture

Debug Output

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/c7d3e3e4-bd2a-44e2-9ed0-03b2b38c78b7/resourceGroups/MyAzureAutomationProd/providers/Microsoft.Automation/automationAccounts/MyAutomationProd/jobSchedules/4676249d-1a82-4ac2-a863-99229f7feecb?api-version=2015-10-31

Headers:
Accept                        : application/json
x-ms-version                  : 2014-06-01

Body:
{
  "properties": {
    "schedule": {
      "name": "CeduleAutoExport"
    },
    "runbook": {
      "name": "AutoExport"
    },
    "parameters": {
      "sqlDatabaseName": "\"myDb\"",
      "SqlServerName": "\"myServer\"",
      "sqlUserName": "\"myDbUser\""
    }
  }
}

Script/Steps for Reproduction

You need

  • Automation account
  • Runbook named AutoExport
  • Parameters of type [string] in the RunBook
    • SqlServerName
    • SqlDatabaseName
    • SqlUserName

Login-AzureRmAccount

$params = @{"SqlServerName"="myServer";"SqlDatabaseName"="myDb";"SqlUserName"="myDbUser"}

Register-AzureRmAutomationScheduledRunbook -Name "AutoExport" -ResourceGroupName "myAzureAutomation" -AutomationAccountName "myAutomation" -ScheduleName "mySchedule" -Parameters $params -ErrorAction Stop;

FranckSix avatar Jan 05 '17 18:01 FranckSix

@AniAnirudh can you take a look at this and direct it to the right folks. Looks like Automation issue.

shahabhijeet avatar Jan 06 '17 19:01 shahabhijeet

@eamonoreilly @safeermohammed Can you take a look

markcowl avatar Jan 17 '17 23:01 markcowl

Hi! Seems like I have the same issues as @FranckSix. The result is that I can not use either runbooks or powershell to schedule runbook jobs. Is there any progress on this matter?

I get the same results, both when I run it as a runbook in Azure Automation and when I run it directly in powershell on my computer.


New-AzureRmAutomationSchedule -AutomationAccountName $AutomationAccountName `
        -Name $ScheduleName `
        -DayInterval 1 `
        -StartTime $StartTime `
        -ResourceGroupName $ResourceGroupNameAutomation
StartTime              : 07.08.2017 16.00.00 +00:00
ExpiryTime             : 31.12.9999 22.59.59 +00:00
IsEnabled              : True
NextRun                : 07.08.2017 16.00.00 +00:00
Interval               : 1
Frequency              : Day
MonthlyScheduleOptions :
WeeklyScheduleOptions  :
TimeZone               : UTC
ResourceGroupName      : automation
AutomationAccountName  : automation
Name                   : Stop-test
CreationTime           : 07.08.2017 10.47.05 +02:00
LastModifiedTime       : 07.08.2017 10.47.05 +02:00
Description            :

$ResourceGroupName =  "avo-test"
$RunbookParameters = @{"ResourceGroupNames"="[`"$ResourceGroupName`"]"}

Register-AzureRmAutomationScheduledRunbook -AutomationAccountName $AutomationAccountName `
        -RunbookName $RunbookNameStop `
        -ScheduleName $ScheduleNameStop `
        -Parameters $RunbookParameters `
        -ResourceGroupName $ResourceGroupNameAutomation

ResourceGroupName     : avo-automation
RunOn                 :
AutomationAccountName : avo-automation
JobScheduleId         : ea28dbba-0d14-4287-804b-74984a2c92b8
RunbookName           : Stop-VmByResourceGroup
ScheduleName          : Stop-test
Parameters            : {ResourceGroupNames}

When I call Get-AzureRmAutomationScheduledRunbook afterwards, there's nothing showing up on the property 'Parameters', but in Azure Automation it shows:

image

Get-AzureRmAutomationScheduledRunbook -ScheduleName stop-test -ResourceGroupName automation -AutomationAccountName automation

ResourceGroupName     : automation
RunOn                 :
AutomationAccountName : automation
JobScheduleId         : ea28dbba-0d14-4287-804b-74984a2c92b8
RunbookName           : Stop-VmByResourceGroup
ScheduleName          : Stop-test
Parameters            : {}

nicolaigj avatar Aug 07 '17 09:08 nicolaigj

Anyone found any solution to get the parameeters value(s) using Get-AzureRmAutomationScheduledRunbook? I am blocked and looking for some input on this...

balasbm avatar Mar 31 '18 22:03 balasbm

:bell: Routing this issue to @act-codegen-extensibility-squad.