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

Get-AzureRmAutomationJob: HybridWorker property not populated when retrieving list of jobs

Open oskarm93 opened this issue 8 years ago • 3 comments

Cmdlet(s)

Get-AzureRmAutomationJob

PowerShell Version

5.1.14409.1012

Module Version

5.1.1

OS Version

10.0.14409.1012

Description

When retrieving a list of jobs within a time range, the individual job entries will not have the HybridWorker property populated (among others).

Sample code:

Get-AzureRmAutomationJob -RunbookName $rb -ResourceGroupName $rg -AutomationAccountName $acc -StartTime ([DateTimeOffset]::Parse('08:00')) -EndTime ([DateTimeOffset]::Parse('09:00'))

If I retrieve the job with -Id parameter, the job object has all properties populated.

Is this expected? I am trying to filter the list of jobs based on whether they ran on a hybrid worker.

oskarm93 avatar Jan 08 '18 10:01 oskarm93

@vrdmr Hey Varad, would you mind taking a look at this issue? It looks like this might be a List vs Get issue in the SDK.

Getting jobs by id calls GetJob, which calls the Get function from the SDK.

Getting jobs by time (and name) calls ListJobByResourceName, which calls the List function from the SDK.

cormacpayne avatar Jan 08 '18 17:01 cormacpayne

There is a workaround to this which is to pipe the entries back through Get-AzureRmAutomationJob as that will provide the id which in turn populates all fields. It is horribly slow and should not be considered a resolution, but it does work.

Example:

Get-AzureRmAutomationJob -ResourceGroupName RGNAME -AutomationAccountName AANAME | Get-AzureRmAutomationJob

jefffanjoy avatar Apr 15 '18 20:04 jefffanjoy

This has been fixed in a newer version.

NarayanThiru avatar Jun 14 '19 01:06 NarayanThiru