PowerShell cmdlet to get Runbook context.
It would be great if you could use in runbook code something like Get-RunbookContext to retrieve the current ResourceGroup and/or Automation Account the runbook is executing in. Then it would be much easier to locate Automation Account Assets like connections and variables without the need to hard-code them into your Runbook. The PowerShell commands available to retrieve and use assets require you to specify the ResourceGroup and Automation Account the asset is stored under.
Thank you for contributing this idea. We are considering how this can be implemented in our future plans.
Stanley Merkx commented
Why not simply add these attributes to $PSPrivateMetadata ??
Should be relatively simple to implement and easy to retrieve without additional cmdlets...