Share via

Cannot Invoke a child runbook using inline execution

Ron Rohlfs 16 Reputation points
2022-07-07T18:07:59.99+00:00

Trying to follow these articles to invoke a runbook inline from another runbook.
https://learn.microsoft.com/en-us/azure/automation/automation-child-runbooks
https://learn.microsoft.com/en-us/system-center/sma/link-runbooks?view=sc-sma-2022&source=docs#invoke-a-child-runbook-using-inline-execution.

The articles say "To invoke a runbook inline from another runbook, you use the name of the runbook and provide values for its parameters exactly like you would use an activity or cmdlet". The example they give is:
$vm = Get-VM -Name "MyVM" -ComputerName "MyServer"
$output = .\Test-ChildRunbook.ps1 -VM $vm -RepeatCount 2 -Restart $true

I'm trying:
$pnpExc = Get-PnPException;
$output = .\Log-PnPException.ps1 -PnPException $pnpExc -Operation 'Get Site Pages Library';

The child Log-PnPException runbook was published before the parent runbook was published.
Both parent and child are PowerShell runbook type so .\ precedes the the child runbook name when calling.

The error is:
| The term '.\Log-PnPException.ps1' is not recognized as a name of a
| cmdlet, function, script file, or executable program. Check the spelling
| of the name, or if a path was included, verify that the path is correct
| and try again.

Azure Automation
Azure Automation

An Azure service that is used to automate, configure, and install updates across hybrid environments.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.