[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetAzureAutomationScheduledRunbook fails when schedule has credential parameters #3776

Open
silverl opened this issue Apr 14, 2017 · 8 comments
Assignees
Labels
Automation automation-leads must also have the "Automation" label customer-reported Service Attention This issue is responsible by Azure service team.

Comments

@silverl
Copy link
silverl commented Apr 14, 2017

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

I logged this 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.
@anyasabo
Copy link

I ran into the same issue recently as well in #3744

In both cases it looks like the the sdk is expecting nested strings for the values.

@silverl
Copy link
Author
silverl commented Apr 14, 2017

Hi, @jonsabo. Thanks. Looks like we're both hitting the same issue.

@cormacpayne
Copy link
Member

@safeermohammed Hey Safeer, would you mind taking a look at this issue?

@safeermohammed
Copy link
Contributor

Yes, looks like the cmdlet was expecting json value and was trying to deserialize the value (Convert-FromJson) hence the error "Invalid JSON primitive"

Will take a look

@hintbw
Copy link
hintbw commented Oct 10, 2017

This is still an issue today with what I encountered.

@maddieclayton
Copy link
Contributor

@safeermohammed Any update on this issue?

@vrdmr vrdmr added the automation-leads must also have the "Automation" label label Mar 15, 2018
@jefffanjoy
Copy link
jefffanjoy commented Apr 15, 2018

This still seems to be an issue but doesn't necessarily require a credential parameter to generate an issue. I see the same problem if I try to use the cmdlet to get the ScheduledRunbook object from an Update Management schedule.

There seems to be no traction to this issue at all in a year. Any plans to address this?

@PaulBoelen
Copy link

I am still running into this issue. Any idea if/when this will be fixed?

@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Sep 26, 2018
@vrdmr vrdmr assigned sourabhguha and GaneshMSAzure and unassigned vrdmr Sep 26, 2019
@andyw248 andyw248 assigned vikram-m and Bpoe and unassigned sourabhguha and GaneshMSAzure Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Automation automation-leads must also have the "Automation" label customer-reported Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests