This PowerShell script is for migration of Automation account assets from the account in primary region to the account in secondary region. This script migrates only Runbooks, Modules, Connections, Credentials, Certificates and Variables.
- Ensure that the Automation account in the secondary region is created and available so that assets from primary region can be migrated to it. It is preferred if the destination automation account is one without any custom resources as it prevents potential resource clash due to same name and loss of data
- System Managed Identities should be enabled in the Automation account in the primary region.
- System Managed Identities of the Source automation account should have contributor access to the subscription it belongs to
- Ensure that Primary Automation account's Managed Identity has Contributor access with read and write permissions to the Automation account in secondary region. You can enable it by providing the necessary permissions in Secondary Automation accounts managed identities.
- This script requires access to Automation account assets in primary region. Hence, it should be executed as a runbook in that Automation account for successful migration.
- Both the source and destination Automation accounts should belong to the same Azure Active Directory(AAD) tenant
- Sign in to the Azure portal.
- Go to Automation account that you want to migrate to another region.
- Under Process Automation, select Runbooks.
- Select Browse gallery and in the search, enter "Migrate Automation account assets from one region to another" and Select.
- In the Import a runbook page, enter a name for the runbook.
- Select Runtime version as either 5.1 or 7.1 (preview) (preferably 5.1 for now, but it works for either)
- Enter the description and select Import.
- In the Edit PowerShell Runbook page, edit the required parameters and execute it.
- You can choose either of the options to edit and execute the script. You can provide the seven mandatory parameters as given in Option 1 or three mandatory parameters given in Option 2 to edit and execute the script:
- Option 1:
- SourceAutomationAccountName
- DestinationAutomationAccountName
- SourceResourceGroup
- DestinationResourceGroup
- SourceSubscriptionId
- DestinationSubscriptionId
- LocationDestinationAccount
- Type[]
- Option 2:
- SourceAutomationAccountResourceId
- DestinationAutomationAccountResourceId
- LocationDestinationAccount
- Type[]
- Option 1: