Get-AzureRmAutomationJob: HybridWorker property not populated when retrieving list of jobs
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.
@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.
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
This has been fixed in a newer version.