Start-AzAutomationRunbook, - error: "Object reference not set to an instance of an object."

Dmitrii Kalmanovich 0 Reputation points
2023-04-07T14:08:15.62+00:00

Hi all. Could anybody give me a clue, what should I do for the following issue.. Need to invoke asynchronous execution of Azure Runbook from parent runbook. Code in the parent runbook looks like this:

$DebugPreference = "Continue"
$AutomationAccountName = "aaaa"
$RunbookName = "test_child_rb"
$ResourceGroupName = "rgrgrg"

 $job = Start-AzAutomationRunbook -AutomationAccountName $AutomationAccountName -Name $RunbookName -ResourceGroupName $ResourceGroupName

The child runbook - is just
Write-Output "test_child" ,without any parameters.
Getting the error: "Object reference not set to an instance of an object."
The full output is following:

Sought all Az modules and got latest version 0.0.0
Cannot fetch PowerShell version due to exception: Object reference not set to an instance of an object.
2:02:34 PM - StartAzureAutomationRunbook begin processing with ParameterSet 'ByAsynchronousReturnJob'.
2:02:35 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
2:02:35 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
Object reference not set to an instance of an object.
2:02:36 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
AzureQoSEvent: Module: Az.Automation:1.7.3; CommandName: Start-AzAutomationRunbook; PSVersion: 3.0.0.0; IsSuccess: False; Duration: 00:00:04.5629325; Exception: Object reference not set to an instance of an object.;
Finish sending metric.
2:02:38 PM - StartAzureAutomationRunbook end processing.
test_DK_parent

Power-Shell runtime version: 5.1.
Tried to do for 7.2 as well, - got the similar error.
What might be the cause?
Thanks.

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,195 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,328 questions
{count} votes