Migrating VM from Azure to GCP using M2VM

Sujay P Pawar
Niveus Solutions
5 min readJun 10, 2024

--

As businesses seek to optimize performance, cost, and scalability, cloud migration is gaining momentum. However, transitioning workloads from Azure to Google Cloud Platform (GCP) can be complex, requiring minimal downtime and data integrity. This blog explores how to achieve a seamless VM migration using the latest version of Migrate to Compute Engine (M2CE) — Version 5.0.

Configuration at Azure Side:

Prerequisites:

Migrate your workload from an Azure source. Before initiating your migration with Azure as a source, set up your Azure environment by completing the following tasks:

Register your App:

To register your app, follow these steps:

  • In the Azure portal, go to the App Registration page, and click New registration.
  • To add new client credentials, click Add a certificate or secret.
  • To add a new client secret, click + New client secret and enter a description and expiry date for the client secret.
  • Click Add.

Your client secret is now ready. Ensure that you copy your client secret value. You will need it later when you set up the source.

Create a custom role.

To migrate your Azure workload, create a custom role and assign it to the app you registered in the Register your app step.

To create a custom role, use the following steps:

  • In the Azure portal, go to the Subscriptions page and select your Azure subscription.
  • Copy the Subscription ID by clicking on it.
  • Save following JSON template and replace SUBSCRIPTION_ID with the Subscription ID you copied in.

Step 2:

Assign the custom role to an app:

To assign a custom role to an app, follow these steps:

  1. In the Azure portal, go to the Access control (IAM) page.
  2. Click + Add and then click Add role assignment.
  3. Search for the custom role you created in Create a custom role by typing m2vm, and select it.
  4. Click Next.
  5. Click + Select members and search for the app name you registered in Register your app and click Select.
  6. To review and assign the custom role to your app, click Review + Assign.

Configuration at GCP Side:

VM Migration:

Step 1: Adding VM to the Migration

GCP> Select the project Name>Migrate for compute engine>Migrate to VM> Select the sources> Select VM to migrate > Add migration.

Step 2: Editing Target Details

Click on migrations tab> Select the VM > Click on edit target details.

1. General Configuration:

  • Provide the target instance name.
  • Choose the project in which you wish to create the VM.
  • Select the zone within the chosen project where you want to create the VM.

2. Machine Configuration:

  • Choose the machine type and series to match the configuration of the source VM.

In the management section:

  • Select the “Migrate instance on host maintenance” option to migrate the VM during host maintenance.
  • Choose “Automatic restart” and set it to “On” so that the VM restarts automatically when there is a maintenance event or your VM crashes because of an underlying hardware issue.

3. Networking Configuration:

  • Choose the VPC (Virtual Private Cloud) network.
  • Select the subnet within the chosen VPC where you want to create the VM.

For the internal IP address:

  • Choose “Automatic” if you want an automatic IP to be assigned by the system.
  • Alternatively, provide a specific IP address if you want to assign a particular IP to the machine.

4. Additional Configuration:

  • Choose the service account for the M2VM.
  • Select the desired disk type for the VM.
  • Choose the appropriate license type for the VM.

Step 3: Start Replication

GCE > M2VM >Click on migrations tab > Select the vm > Migration > Start replication.

Initial replication time will vary based on:

  • Storage footprint of source VMs
  • Available bandwidth between replication sites
  • Larger VMs and slower connections will lengthen replication duration
  • Upon completing initial replication, cut-over to replica VMs is possible

However, executing a test clone is recommended first to:

  • Validate proper configuration
  • Verify synchronization and replication integrity
  • Test clone provides opportunity to confirm operation before full cut-over

Step 4: Test Clone

GCE > M2VM > Click on migrations tab> Select the VM> Cut over and test clone>Test clone

  • The test clone and cut-over status fields provide real-time updates on test clone completion.
  • Successfully created test clones will be accessible as standard Compute Engine virtual machines (VMs) and can undergo inspection and validation per normal procedures.
  • Replication of the source image will persist even with active test clone VMs.
  • However, in-progress test clones will not receive updates from ongoing replication events, rather they will persist in the state at initiation time.
  • To evaluate newer versions of the image, new test clone VMs must be spun up. Once testing is satisfactorily completed, test clone VMs can safely be decommissioned.
  • Provided the replication process and test cloning have succeeded without issues, the next step is performing the cut-over to migrate fully to the replica VMs.

Check Test Clone History:

Select the VM>Test clone/Replication History

--

--