Migrating Line-of-Business Applications to Azure with Azure Migrate

In this comprehensive guide, we’ll walk through the step-by-step process of assessing and migrating a multi-tier application from on-premises Hyper-V infrastructure to Azure. We’ll leverage various Azure tools and services throughout the migration journey, including Azure Migrate, Azure Site Recovery, Azure SQL Database, and the Azure Database Migration Service.

Abstract and Learning Objectives

This hands-on lab will teach you how to assess and migrate a complex, multi-tier application from Hyper-V to Azure. You’ll learn the roles and usage of key Azure migration tools, and apply them to successfully migrate the on-premises ‘SmartHotel’ application to the cloud.

After completing this guide, you will:

  • Understand how to use Azure Migrate to discover and assess your on-premises environment
  • Know how to leverage Azure Site Recovery to migrate your application and web tiers to Azure
  • Learn to migrate an on-premises database to Azure SQL Database using the Azure Database Migration Service
  • Gain experience in configuring networking, IP addresses, and database connections for your migrated application

Overview

Before the lab, you will have a pre-deployed on-premises infrastructure hosted in Hyper-V. This infrastructure hosts the multi-tier ‘SmartHotel’ application, using separate Hyper-V VMs for each application tier.

During the lab, you will migrate the entire SmartHotel application stack to Azure. This includes:

  • Assessing the on-premises environment using Azure Migrate
  • Migrating the database tier to Azure SQL Database using the SQL Server Data Migration Assistant (DMA) and the Azure Database Migration Service (DMS)
  • Migrating the web and application tiers using Azure Site Recovery

The migration will cover both Windows and Linux VMs.

Solution Architecture

The SmartHotel application comprises 4 VMs hosted in Hyper-V:

  • Database Tier: Hosted on the smarthotelSQL1 VM, running Windows Server 2016 and SQL Server 2017
  • Application Tier: Hosted on the smarthotelweb2 VM, running Windows Server 2012 R2
  • Web Tier: Hosted on the smarthotelweb1 VM, running Windows Server 2012 R2
  • Web Proxy: Hosted on the UbuntuWAF VM, running Nginx on Ubuntu 18.04 LTS

For simplicity, there is no redundancy in any of the tiers.

Note: The Hyper-V host itself is deployed as an Azure VM for convenience. For the purposes of this lab, you should consider it an on-premises machine.

The migration workflow is as follows:

  1. Assess the on-premises environment using Azure Migrate:

    • Deploy the Azure Migrate appliance on the Hyper-V host to gather information about the environment
    • Install the Microsoft Monitoring Agent and Dependency Agent on the VMs to enable Azure Migrate dependency visualization
  2. Migrate the Database Tier to Azure SQL Database:

    • Install the SQL Server Data Migration Assistant (DMA) on the Hyper-V host to assess the on-premises database
    • Use the DMA to migrate the database schema to Azure SQL Database
    • Complete the data migration using the Azure Database Migration Service (DMS)
  3. Migrate the Application and Web Tiers using Azure Site Recovery:

    • Deploy the Azure Site Recovery collector appliance into the Hyper-V environment
    • Set up the Azure environment, including a storage account and virtual network
    • Replicate the application and web tier VMs to Azure
    • Perform a test failover to migrate the application to Azure

After migration, the application could be further modernized to use Azure Application Gateway instead of the Ubuntu Nginx VM, and Azure App Service to host both the web tier and application tier. However, these optimizations are out of scope for this lab, which focuses on a ‘lift and shift’ migration to Azure VMs.

Requirements

  1. You will need Owner or Contributor permissions for an Azure subscription to use in the lab.
  2. Your Azure subscription must have sufficient unused quota to deploy the VMs used in this lab (at least 15 vCPUs available).

For further details, see the Before the HOL - Line-of-business application migration setup guide.

Exercise 1: Discover and Assess the On-Premises Environment

In this first exercise, you will use Azure Migrate to assess the on-premises Hyper-V environment and prepare for migration.

Task 1: Create the Azure Migrate Project

  1. Log into the Azure Portal and navigate to the Azure Migrate service.
  2. Click the Add tool(s) button to create a new Azure Migrate project.
  3. Select your Azure subscription and create a new resource group named AzureMigrateRG.
  4. At the ‘Select assessment tool’ step, choose Azure Migrate: Server Assessment.
  5. At the ‘Select migration tool’ step, choose Azure Migrate: Server Migration.
  6. Review the settings and click Add tool(s) to create the Azure Migrate project.
  7. Once the deployment completes, navigate to the ‘Servers’ panel and verify the Azure Migrate: Server Assessment tool is available.

Task 2: Deploy the Azure Migrate Appliance

  1. Click Discover to open the ‘Discover machines’ blade, and select Yes, with Hyper-V.
  2. Follow the instructions to download, deploy, and configure the Azure Migrate appliance on the Hyper-V host VM.
  3. Create a new ‘Azure Migrate Switch’ virtual switch in Hyper-V to isolate the appliance from the application VMs.
  4. Import the Azure Migrate appliance VM and configure its network settings using a PowerShell script.
  5. Start the Azure Migrate appliance VM and complete the configuration wizard.

Task 3: Configure the Azure Migrate Appliance

  1. Connect to the Azure Migrate appliance VM and complete the configuration wizard.
  2. Register the appliance with your Azure Migrate project.
  3. Provide the Hyper-V host credentials and add the SmartHotelHost to the list of hosts to discover.
  4. Wait for the discovery process to complete, then verify the discovered servers in the Azure portal.

Task 4: Create a Migration Assessment

  1. In the Azure Migrate blade, click + Assess to start a new migration assessment.
  2. Review the available assessment properties and customize as needed.
  3. Create a new server group for the ‘SmartHotel VMs’ and select the appropriate VMs.
  4. Wait for the assessment to complete, then review the results, including Azure readiness and migration cost estimates.
  5. Explore the assessment details, such as the ‘Unsupported boot type’ issue for smarthotelweb1.

Task 5: Configure Dependency Visualization

  1. Install the Microsoft Monitoring Agent and Dependency Agent on the application VMs to enable dependency visualization.
  2. For the Linux UbuntuWAF VM, use the Azure Cloud Shell to remotely install the agents.
  3. Generate some traffic on the SmartHotel application to populate the dependency data.

Task 6: Explore Dependency Visualization

  1. In the Azure Migrate blade, review the ‘Discovered items’ and click ‘View dependencies’ for the smarthotelweb1 VM.
  2. Explore the dependency visualization, examining the processes and connections between the VMs.
  3. Use the multi-select functionality to group VMs for migration assessment.

Exercise 2: Migrate the Application Database

In this exercise, you will migrate the application database from the on-premises Hyper-V VM to an Azure SQL Database.

Task 1: Create an Azure SQL Database

  1. In the Azure portal, create a new Azure SQL Database named smarthoteldb.
  2. Create a new SQL server for the database, using the server name smarthoteldb[unique number].
  3. Configure the SQL server firewall to allow access from the on-premises Hyper-V host VM.

Task 2: Assess the On-Premises Database

  1. On the Hyper-V host VM, install the SQL Server Data Migration Assistant (DMA).
  2. Use the DMA to assess the on-premises SmartHotel.Registration database for migration to Azure SQL Database.
  3. Review the assessment results, noting any compatibility issues or unsupported features.

Task 3: Migrate the On-Premises Database

  1. In the DMA, create a new migration project targeting Azure SQL Database.
  2. Specify the connection details for the on-premises SQL Server and the Azure SQL Database.
  3. Select the SmartHotel.Registration database and migrate the schema.
  4. Migrate the data to the Azure SQL Database.

Exercise 3: Migrate the Application and Web Tiers using Azure Site Recovery

In this final exercise, you will migrate the application and web tiers of the SmartHotel application to Azure using Azure Site Recovery.

Task 1: Create a Storage Account

  1. In the Azure portal, create a new storage account that will be used by Azure Site Recovery for replicating the virtual machines.

Task 2: Create a Virtual Network

  1. Create a new virtual network named SmartHotelASRVNet that will host the migrated VMs.

Task 3: Configure and Start Replication of VMs

  1. In the Azure Migrate blade, select the VMs to be migrated and configure the replication settings.
  2. Review the target compute and disk settings for the migrated VMs.
  3. Start the replication process to copy the on-premises VMs to Azure.

Task 4: Test Migration

  1. Once replication is complete, perform a test failover of the SmartHotelWeb* VMs to the Azure virtual network.
  2. Verify the test failover resources are created in the SmartHotelASRRG resource group.

Task 5-7: Configure Database Connection, Public IP, and Test Application

  1. On the smarthotelweb2-test VM, update the database connection string in the Web.config to point to the Azure SQL Database.
  2. Associate a public IP address with the UbuntuWAF-test VM to access the migrated application.
  3. Verify the SmartHotel application is accessible and functioning correctly in Azure.

Task 8: Cleanup the Test Failover

  1. In the Azure Site Recovery portal, clean up the test failover resources, including the test VMs.

After the Hands-on Lab

  1. Clean up all the resources created during the lab to avoid continued billing.

This comprehensive guide has walked you through the end-to-end process of assessing and migrating a multi-tier application from on-premises Hyper-V to Azure. By leveraging the various Azure migration tools, you’ve gained practical experience in successfully migrating workloads to the cloud.

For more information, please refer to the original hands-on lab instructions.