This repository contains artefacts that help with traditional lift-and-shift or disaster recovery of IaaS workloads (physical or virtual machines) that can be moved with Azure Site Recovery Configuration/Azure Migrate server/appliance using an automated first approach. This automated approach is made possible by:
- Leveraging Azure DevOps pipelines, and
- Modified scripts provided by Microsoft at https://github.com/Azure/azure-docs-powershell-samples/tree/master/azure-migrate (MIT License).
This repository makes it possible for any IT System Administrator or IT Department to be able to offer IaaS Migration-as-a-Service capability to their own organisation/ business. All the end-user needs to know is how to pre-fill the appropriate CSV file consumed by the pipelines.
In summary, the steps for the pipelines are:
-
First, read the CSV file that contains the configuration data for the "application environment".
-
Validate that all of the information in the CSV file is correct by checking that the subscription, resource groups and resources exist.
-
Support the migration of the workload or set up the DR in Azure for the workload.
An application environment is a logical group of IaaS workloads that should migrate together. That could for example be your entire footprint (big bang cut over) or logical groupings of servers like SAP, File Shares that you want to migrate in a particular batch.
It's highly recommended that when you set up your application environment groupings, you create the same 'logical groupings' in Azure Migrate itself for the application assessments. This will help with right sizing and not needing to specify the Sku size yourself.
- Create your Azure Migrate resource group and Azure Migrate Project in the Azure Portal. See Create and manage projects and Assign Azure roles using the Azure portal.
- Make sure you have configured and installed the Agent and/or Agentless appliances in your on-premises environments. See Azure Migrate appliance
- Document your SubcriptionId, TenantId and Azure Migrate Resource Group and Project Names from the Azure Portal. They are needed for the CSV files later.
- Update
Connect-Azure.json
with the tenantId and subscriptionId for each Azure Subscription where workloads will be migrated to.
- Create an Azure AD Service Principal that is an owner to the Azure Subscription(s) where your Azure Migrate Project is and where you wish to failover workloads to. See Use the portal to create an Azure AD application and service principal and
- It's noted that these permissions are excessive, but as Azure Migrate must be able to create resource locks, the Service Principal does require significant permissions.
- Create an Azure Storage Account with a single container, ideally in the same Resource Group as the Azure Migrate Project, to keep logs of pipeline runs for you.
- Grant the Service Principal blob contributor rights to the created storage account.
- Update the
azure-jobs.yml
file with the storage account name and container created.
- Configure the Service Principal as a Service Connection inside your Azure DevOps project. See Manage service connections.
- Create the Agentless and Agent migratins pipelines in Azure DevOps. See Create your first pipeline.
Note: The operator will require Project Contributor rights to perform the tasks described here.
-
Copy the Agentless or Agent example CSV to the same folder and the source example.
-
Rename the copied CSV file to the format [AppName].[Environment].csv
E.g. AppName.Dev.csv
-
Each line represents a server to be migrated. Copy the second line for every server that forms the application stack.
-
Update all of the columns with the required values. Blank columns are not mandatory but can be updated if required.
-
Save, commit and push the updated CSV file.
- Log on to Azure DevOps.
- Open the either your
Agentless Migration
orAgent Migration
pipeline. - Click "Run Pipeline"
- Select the Branch that the CSV was committed to e.g. main
- Type the name of the CSV file.
- Click "Stages to run"
- Select the first stage only
- Click "Use selected stages"
- Click "Run"
- Once the previous step completes successfully, repeat that step for all stages one at a time.
The following details the stages in the Azure Pipelines for both Agent and Agentless migrations.
- StartReplication - Starts the replication process to replicate disks to Azure.
- UpdateMachineProperties - Updates the virtual machines properties.
- StartTestMigration - Start the test failover step.
- CleanUpTestMigration - Clean up the test failover step.
- StartMigration - Cut over the workload to Azure.
- EnableServices - Run custom scripts to enable services like Azure Backup.
- StopReplication - Stop replicating the disks from on-premises. Aka, migration complete.