In some situations, you may need to move a script/Runbook between subscriptions or even customers. We can always edit the Runbook and copy and paste the content. However, there are more elegant ways to copy a Runbook using either Azure Portal or PowerShell. Using the Azure Portal, go to the desired Runbook properties blade. Click on Export and the .ps1 file (if it is a PowerShell file) will be downloaded to your workstation, as depicted in the image below.
If you want to perform that from a PowerShell session, then the cmdlet to complete the task is Export-AzAutomationRunbook.
Note: At the time of writing, the -OutputFolder does not recognize the Linux file system of Azure Cloud Shell and it fails to create the file.
More Quick Tips articles
- New from Microsoft: Azure Security Center onboarding guide
- Fixing Azure Key Vault when moving to a different tenant
- Restore Azure Key Vault using just two PowerShell cmdlets
- This overlooked feature in Visual Studio Code can speed release time
- Enabling Front Door managed certificates in Azure: Status update