# Migrate Hyper-V VM with Azure Migrate ## Introduction [**Azure Migrate**](https://docs.microsoft.com/en-us/azure/migrate/migrate-services-overview) provides a centralized hub to assess and migrate to Azure on-premises servers, infrastructure, applications, and data. It provides the following: * **Unified migration platform**: A single portal to start, run, and track your migration to Azure. * **Range of tools**: A range of tools for assessment and migration. Azure Migrate tools include Azure Migrate: Discovery and assessment and Azure Migrate: Server Migration. Azure Migrate also integrates with other Azure services and tools, and with independent software vendor (ISV) offerings. * **Assessment and migration**: In the Azure Migrate hub, you can assess and migrate: * **Windows, Linux and SQL Server**: Assess on-premises servers including SQL Server instances and migrate them to Azure virtual machines or Azure VMware Solution (AVS) (Preview). * **Databases**: Assess on-premises databases and migrate them to Azure SQL Database or to SQL Managed Instance. * **Web applications**: Assess on-premises web applications and migrate them to Azure App Service by using the Azure App Service Migration Assistant. * **Virtual desktops**: Assess your on-premises virtual desktop infrastructure (VDI) and migrate it to Windows Virtual Desktop in Azure. * **Data**: Migrate large amounts of data to Azure quickly and cost-effectively using Azure Data Box products. ## Scenario In this lab, we will create a Windows Virtual Machine and install **Hyper-V** on it to simulate the on-premise environment. Then use Azure Migrate as the hub for executing a migration, together with accompanying tools. ![](https://i.imgur.com/HzVNHf6.png) ## Preparation * An Azure account with Azure Subscription ## Step by step ### Step 1: Installing Hyper-V in Azure Nested Virtualization 1. Create an Azure VM capable of nesting (Windows Server 2016, etc) ![](https://i.imgur.com/WJDzUan.png) ![](https://i.imgur.com/IbIFrCX.png) 2. Connect and login to the Azure VM ![](https://i.imgur.com/iBDGl0S.png) ![](https://i.imgur.com/FDn6J7J.png) ![](https://i.imgur.com/wyqkVFk.png) ![](https://i.imgur.com/pL6lisJ.png) ![](https://i.imgur.com/fsiODV4.png) ![](https://i.imgur.com/U1LdCRM.png) ![](https://i.imgur.com/r4aMmMe.png) ### Step 2: Install Ubuntu with Hyper-V ![](https://i.imgur.com/MscB1bn.png) ![](https://i.imgur.com/FKaOwne.png) 1. Here can name our virtual machine. 2. Select **Store the virtual machine in a different location** to store the virtual machine. ![](https://i.imgur.com/H9ZqDuL.png) 3. Choose the generation of the virtual machine ![](https://i.imgur.com/SnOJN7d.png) 4. Specify the amount of money to allocate to this virtual machine. ![](https://i.imgur.com/vQ1FCL2.png) 5. Configure Networking. ![](https://i.imgur.com/U6N9UA5.png) 6. Connect virtual Hard Disk. ![](https://i.imgur.com/hnWfRPF.png) 7. Installation Options. ![](https://i.imgur.com/o7MbMJf.png) 8. Completing the New Virtual Machine Wizard. ![](https://i.imgur.com/a5eFNSA.png) ![](https://i.imgur.com/tjojocP.png) ![](https://i.imgur.com/05NxUzs.png) ### Step 3: Discover and assess the on-premises environment > In this step, you will use Azure Migrate: Server Assessment to assess the on-premises environment. This will include selecting Azure Migrate tools, deploying the Azure Migrate appliance into the on-premises environment, creating a migration assessment, and using the Azure Migrate dependency visualization. 1. Select **All services** in the portal’s left navigation, then search for and select **Azure Migrate** to open the Azure Migrate Overview blade, shown below. ![](https://i.imgur.com/3FFzPpK.png) 2. Select **Discover assess and migrate**, then Create a project. Select your subscription and create a new resource group named *AzureMigrate*. Enter *SmartHotelMigration* as the Migrate project name, and choose geography close to you to store the migration assessment data. Then select **Create**. ![](https://i.imgur.com/5WjHkEA.png) 3. The Azure Migrate deployment will start. Once it has been completed, you should see the Azure Migrate: Discovery and assessment and Azure Migrate: Server Migration panels for the current migration project, as shown below. ![](https://i.imgur.com/IVSPMKt.png) ### Step 4: Deploy the Azure Migrate appliance > In this step, you will deploy and configure the Azure Migrate appliance in the on-premises Hyper-V environment. This appliance communicates with the Hyper-V server to gather configuration and performance data about your on-premises VMs and returns that data to your Azure Migrate project. 1. Under **Azure Migrate: Server Assessment**, select **Discover** to open the **Discover machines** blade. Under **Are your machines virtualized?**, select **Yes, with Hyper-V**. ![](https://i.imgur.com/u5log3U.png) 2. In **1: Generate Azure Migrate project key**, provide a name for the Azure Migrate appliance that you will set up for the discovery of Hyper-V VMs. Select **Generate key** to start the creation of the required Azure resources. ![](https://i.imgur.com/VoY7P5I.png) 3. **Wait** for the key to be generated, then copy the **Azure Migrate project key** to your clipboard. ![](https://i.imgur.com/5d2bZ8s.png) 4. Download Azure Migrate appliance ![](https://i.imgur.com/t8xPdSN.png) 5. Set up an appliance with a script 6. Extract the zipped file to a folder on the server that will host the appliance. Make sure you don't run the script on an existing Azure Migrate appliance. ![](https://i.imgur.com/a2665Sl.png) 7. Launch PowerShell on the server, with administrator (elevated) privileges. 8. Change the PowerShell directory to the folder containing the contents extracted from the downloaded zipped file. 9. Run the script **AzureMigrateInstaller.ps1**. ![](https://i.imgur.com/XYmwRr5.png) ### Step 5: Enroll your device with Azure Migrate ![](https://i.imgur.com/ddyrJd5.png) 1. Paste the project key copied from the portal site. ![](https://i.imgur.com/KeNVogL.png) ![](https://i.imgur.com/tF5T7qP.png) ![](https://i.imgur.com/5OYywPx.png) 2. Specify host login as the friendly name for credentials, username, and password for the Hyper-V host/cluster that the appliance will use to discover VMs. Select Save. ![](https://i.imgur.com/9m51lti.png) 3. select **Add discovery source** to specify the Hyper-V host/cluster IP address/FQDN and the friendly name for credentials to connect to the host/cluster. ![](https://i.imgur.com/Nl5xrtB.png) 4. Select **Start discovery** to kick off VM discovery from the successfully validated hosts/clusters. ![](https://i.imgur.com/jFcQxJt.png) 5. Return to the **Azure Migrate** blade in the Azure portal. Select **Servers**, then select **Refresh**. Under **Azure Migrate: Server Assessment** you should see a count of the number of servers discovered so far. If discovery is still in progress, select **Refresh** periodically until discovered servers are shown. This may take several minutes. ![](https://i.imgur.com/35WOETU.png) ### Step 6: Create a migration assessment, and using the data gathered during the discovery phase. >In this step, you will use Azure Migrate to create a migration assessment for the SmartHotel application, using the data gathered during the discovery phase. 1. Continuing from *step 5*, select Assess under Azure Migrate: Server Assessment to start a new migration assessment. ![](https://i.imgur.com/uv4sgUa.png) 2. On the **Create Assessment Basics** blade, ensure the Assessment type to be Azure VM and Discovery Source to be Machines discovered from Azure Migrate Appliance. Under **Assessment properties**, select **Edit**. ![](https://i.imgur.com/jwFUV8l.png) 3. The Assessment properties blade allows you to tailor many of the settings used when making a migration assessment report. Take a few moments to explore the wide range of assessment properties. Hover over the information icons to see more details on each setting. Choose any settings you like, then select Save. (You have to make a change for the Save button to be enabled; if you don’t want to make any changes, just close the blade.) ![](https://i.imgur.com/2lOGCag.png) 4. Select Next to move to the Select machines to assess tab. Choose to Create New and enter the group name ![](https://i.imgur.com/oWeVfLD.png) 5. Select **Next**, followed by **Create assessment**. On the **Azure Migrate - Windows, Linux, and SQL Server** blade, select **Refresh** periodically until the number of assessments shown ![](https://i.imgur.com/WMc1bmp.png) 6. Select Assessments under Azure Migrate: Discovery and assessment to see a list of assessments. Then select the actual assessment. ![](https://i.imgur.com/7aH3TTE.png) 7. Select **Azure readiness** ![](https://i.imgur.com/49XmazC.png) 8. Select **Unknown OS** for **UbuntuWAF**. A new browser tab opens showing Azure Migrate documentation. Note on the page that the issue relates to the OS not being specified in the host hypervisor, so you must confirm the OS type and version are supported. ![](https://i.imgur.com/W9zogYP.png) 9. Return to the portal browser tab to see details of the issue. Note the recommendation to migrate the VM using Azure Migrate: Server Migration. ![](https://i.imgur.com/8n1MTxs.png) ### Step 7: Register the Hyper-V Host with Azure Migrate: Server Migration 1. Return to the **Azure Migrate** blade in the Azure Portal, and select **Servers** under **Migration goals** on the left. Under **Migration Tools**, select **Discover**. ![](https://i.imgur.com/RtPF1MV.png) 2. In the **Discover machines** panel, under **Are your machines virtualized**, select **Yes, with Hyper-V**. Under **Target region** enter **the same region as used for your Azure SQL Database** which can be found in the Azure portal and check the confirmation checkbox. Select **Create resources** to begin the deployment of the Azure Site Recovery resource used by Azure Migrate: Server Migration for Hyper-V migrations. ![](https://i.imgur.com/LDuTxjk.png) 3. Copy the Download link for the Hyper-V replication provider software installer to your clipboard. ![](https://i.imgur.com/z3d58th.png) 4. Open the remote desktop window, launch Chrome from the desktop shortcut, and paste the link into a new browser tab to download the Azure Site Recovery provider installer. 5. Return to the Discover machines page in your browser (outside remote desktop session). Select the blue Download button and download the registration key file. ![](https://i.imgur.com/K8p5mhp.png) 6. Open the file location in Windows Explorer, and copy the file to your clipboard. Return to the remote desktop session and paste the file to the desktop. 7. Still within the remote desktop session, open the **AzureSiteRecoveryProvider.exe** installer you downloaded a moment ago. On the **Microsoft Update** tab, select **Off** and select **Next**. Accept the default installation location and select **Install**. 8. Select **Finalize registration**, which should now be enabled. ![](https://i.imgur.com/gDmjaPA.png) ![](https://i.imgur.com/8Q13In9.png) 9. The Azure Migrate: Server Migration panel should now show discovered servers. ![](https://i.imgur.com/f58Gelp.png) ### Step 8: Enable Replication from Hyper-V to Azure Migrate 1. Under **Azure Migrate: Server Migration**, select **Replicate**. This opens the **Replicate** wizard. ![](https://i.imgur.com/EgIpYOH.png) 2. In the Source settings tab, under Are your machines virtualized?, select Yes, with Hyper-V from the drop-down. Then select Next. ![](https://i.imgur.com/Nj2Ua2u.png) 3. In the **Virtual machines** tab, under **Import migration settings from an assessment**, select **Yes, apply migration settings from an Azure Migrate assessment**. Select the VM group and the migration assessment. The **Virtual machines** tab should now show the virtual machines included in the assessment. Select the virtual machines, then select **Next**. ![](https://i.imgur.com/iyvfsT4.png) 4. In the **Target settings** tab, select your subscription and the existing resource group. Under **Replication storage account** select the **migration storage…** storage account and under **Virtual Network** select *jeff*. Under **Subnet** select *default*. Select **Next**. ![](https://i.imgur.com/iO9uKug.png) 5. In the **Compute** tab, select the **Standard_F2s_v2** VM size for each virtual machine. Select **Next** ![](https://i.imgur.com/3d67ndj.png) 6. In the **Disks** tab, review the settings but do not make any changes. Select **Next**, then select **Replicate** to start the server replication. 7. In the **Azure Migrate - Servers** blade, under **Azure Migrate: Server Migration**, select the **Overview** button. ![](https://i.imgur.com/TbEKzBq.png) 8. Select **Replicating Machines** under **Manage** on the left. Select **Refresh** occasionally and wait until the machines have a **Protected** status, which shows the initial replication is complete. This will take several minutes. ![](https://i.imgur.com/4nXGX2n.png) ### Step 9: Server migration 1. Return to the **Azure Migrate: Server Migration** overview blade. Under **Step 3: Migrate**, select **Migrate**. ![](https://i.imgur.com/neUGrOt.png) 2. On the **Migrate** blade, select the 3 virtual machines then select **Migrate** to start the migration process. ![](https://i.imgur.com/MsJozgL.png) ![](https://i.imgur.com/tM15HZA.png) 3. Navigate to the resource group and check that the VM, network interface, and disk resources have been created for each of the virtual machines being migrated. ![](https://i.imgur.com/puPqXU4.png) ### Step 10: Clean up resources 1. You should complete all of these steps after attending the Hands-on lab. Failure to delete the resources created during the lab will result in continued billing. ## Conclusion In this exercise, you migrated the web tier and application tiers of the application from on-premises to Azure using Azure Migrate: Server Migration. You also installed the VM Agent on the migrated virtual machines and cleaned up migration resources. ## Reference [**Microsoft Azure Workshop - Application Migration**](https://cloudworkshop.blob.core.windows.net/lob-application-migration/Hands-on%20lab/HOL%20step-by%20step%20-%20Line-of-business%20application%20migration.html#task-1-create-a-storage-account)