# Move Azure SQL Database and Virtual Machine resources to another region using Azure Resource Mover. ## Introduction [**Azure Resource Mover**](https://docs.microsoft.com/en-us/azure/resource-mover/overview) might move resources to different Azure regions to: * **Align to a region launch**: Move resources to a newly introduced Azure region that wasn't previously available. * **Align for services/features**: Move resources to take advantage of services or features that are available in a specific region. * **Respond to business developments**: Move resources to a region in response to business changes, such as mergers or acquisitions. * **Align for proximity**: Move resources to a region local to your business. * **Meet data requirements**: Move resources to align with data residency requirements, or data classification needs. * **Respond to deployment requirements**: Move resources that were deployed in error, or move in response to capacity needs. * **Respond to decommissioning**: Move resources because a region is decommissioned. ## Scenario * In this lab, you will move **Azure SQL** databases, elastic pools, **Azure VMs**, and related network/storage resources to a different **Azure** region, using Azure Resource Mover. ![](https://i.imgur.com/rKfl0Ji.png) ## Prerequisites * If you don't have an **Azure subscription**, create a free account before you begin. Then sign in to the [**Azure portal**](https://portal.azure.com/). * [**Make sure**](https://docs.microsoft.com/en-us/azure/resource-mover/common-questions) the regions are currently supported * [**Make sure**](https://docs.microsoft.com/en-us/azure/resource-mover/support-matrix-move-region-azure-vm) the versions that support for moving **Azure VMs** between Azure regions * [**Make sure**](https://docs.microsoft.com/en-us/azure/resource-mover/support-matrix-move-region-sql) the versions that support for moving **Azure SQL** resources between Azure regions * Make sure in the target region, create a target server for each source server. ## Step by step ### Step 1: Create a VM 1. Type **virtual machines** in the search. ![](https://i.imgur.com/uHxAXhk.png) * Under **Services**, select **Virtual machines**. * In the **Virtual machines** page, select **+ Add**. And select **+ virtual machine**. ![](https://i.imgur.com/oE0qtw5.png) * In the **Basics** tab, under **Project details**, make sure the correct subscription is selected, In **Resource group**, select an existing resource group, or create a new one. ![](https://i.imgur.com/s6N0JJn.png) * Under **Instance details**, type the name for the **Virtual machine name**, choose *East US* for your **Region**, and choose Red Hat for your **Image**. Leave the other defaults. ![](https://i.imgur.com/pEoz60V.png) * Under **Administrator account**, select **Password**. * Under **Inbound port rules** > **Public inbound ports**, choose **Allow selected ports** and then select **SSH (22)** and **HTTP (80)** and **SSH (443)** from the drop-down. * Leave the remaining defaults and then select the **Review + create** button at the bottom of the page. ![](https://i.imgur.com/PYMjLgo.png) 2. On the **Create a virtual machine page**, you can see the details about the VM you are about to create. When you are ready, select **Create**. ![](https://i.imgur.com/59ioRUA.png) ### Step 2: Create an Azure SQL 1. Sign in to the **Azure portal** 2. In the search box, type *Azure SQL*. Under **Services**, select **Azure SQL**. ![](https://i.imgur.com/kvaac0t.png) 3. In **Azure SQL**, select **+New**. ![](https://i.imgur.com/Nle7tXu.png) 4. In **Select SQL deployment option** > **SQL databases**, select **Single databases**, and select **Create**. ![](https://i.imgur.com/kxZzUUf.png) ### Step 3: Create an Azure SQL Databases >Make sure in the target region, create a target server for each source server. 1. Under **Basics** screen. * In **Resource group**, select an existing resource group for the vault, or create a new one. * In **Database details** named for your Databases, and select an existing **Server**, or create a new one. ![](https://i.imgur.com/bWqz6kr.png) * Select **Yes** for SQL elastic pool, and select an existing **Server**, or create a new one. * Leave the other defaults, and select **Review + create** ![](https://i.imgur.com/QFUIVDD.png) * Select **Create** ![](https://i.imgur.com/wSZzukj.png) ### Step 4: Select resources 1. In the **Azure portal**, search for **Resource mover**. Then, under **Services**, select **Azure Resource Mover**. >You can select any supported resource type in any resource group in the selected source region. >You move resources to a target region in the same subscription as the source region. If you want to change the subscription, you can do that after the resources are moved. ![](https://i.imgur.com/wGjxcBp.png) 2. Select **Move access regions** ![](https://i.imgur.com/7wdhzZC.png) 3. In **Move resources** > **Source + destination**, select the source subscription and region. 4. In **Destination**, select the region to which you want to move the resources. Then click **Next**. ![](https://i.imgur.com/dSBnuZf.png) 5. In **Resources to move**, click **Select resources**. ![](https://i.imgur.com/i5p8BlZ.png) 6. In **Select resources**, select the resources. You can only add resources supported for the move. Then click **Done**. ![](https://i.imgur.com/raecMbY.png) 7. In **Resources to move**, click **Next**. ![](https://i.imgur.com/iyo1NLn.png) 8. In **Review**, check the source and destination settings. Verify that you understand that metadata about the move will be stored in a resource group created for this purpose in the metadata region. ![](https://i.imgur.com/BJ5bAYO.png) 9. Click **Proceed**, to begin adding the resources. ![](https://i.imgur.com/GIVrQ6Y.png) 10. After the add process finishes successfully, click **Adding resources for move** in the notification icon. ![](https://i.imgur.com/woTEF2z.png) 11. After clicking the notification, review the resources on the **Across regions** page. ![](https://i.imgur.com/bcp3ZVh.png) ### Step 5: Resolve dependencies 1. In **Across regions**, if resources show a *Validate dependencies* message in the **Issues** column, click the **Validate dependencies** button. The validation process begins. 2. If dependencies are found, click **Add dependencies**. ![](https://i.imgur.com/0pNzeh9.png) 3. In **Add dependencies**, leave the default **Show all dependencies** option. * Show all dependencies iterates through all of the direct and indirect dependencies for a resource. For example, for a VM it shows the NIC, virtual network, network security groups (NSGs), etc. * Show first-level dependencies only show only direct dependencies. For example, for a VM it shows the NIC, but not the virtual network. 4. In **Add dependencies**, select the dependent resources > **Add dependencies**. Monitor progress in the notifications. ![](https://i.imgur.com/aFBddAa.png) 5. Add additional dependencies if needed, and validate dependencies again. 6. On the **Across regions** page, verify that resources are now in a Prepare pending state, with no issues. ### Step 6: Prepare to move the source resource group >During the Prepare process, Resource Mover generates Azure Resource Manager (ARM) templates using the resource group settings. Resources inside the resource group aren't affected. 1. In **Across regions**, select the source resource group > **Prepare**. ![](https://i.imgur.com/BdcSTmQ.png) 2. In **Prepare resources**, click **Prepare**. ![](https://i.imgur.com/4D63eKu.png) 3. After preparing the resource group, it's in the **Initiate move pending** state. ![](https://i.imgur.com/3yo4xbS.png) ### Step 7: Move the source resource group 1. In **Across regions**, select the resource group > **Initiate Move** ![](https://i.imgur.com/ROtpfSx.png) 2. ln **Move Resources**, click **Initiate move**. The resource group moves into an **Initiate move in progress** state. ![](https://i.imgur.com/ezzmOA0.png) 3. After initiating the move, the target resource group is created, based on the generated ARM template. The source resource group moves into a **Commit move pending** state. ![](https://i.imgur.com/eXNmYJG.png) 4. To commit and finish the move process: * In **Across regions**, select the resource group > **Commit move**. ![](https://i.imgur.com/bvFtQ5N.png) * ln **Move Resources**, click **Commit**. ![](https://i.imgur.com/MoFrEol.png) >After committing the move, the source resource group is in a **Delete source pending** state. ![](https://i.imgur.com/qt3k9Sc.png) ### Step 8: Prepare resources to move >Now that the source resource group is moved, you can prepare to move other resources that are in the **Prepare pending** state. 1. In **Across regions**, verify that resources are now in a **Prepare pending** state, with no issues. If they're not, validate again and resolve any outstanding issues. ![](https://i.imgur.com/2P82BhX.png) * Select the resources you want to prepare. * Select **Prepare**. ![](https://i.imgur.com/PgSpHdF.png) ![](https://i.imgur.com/9TVXUDZ.png) >* During the preparation process, the Azure Site Recovery Mobility agent is installed on VMs, to replicate them. >* VM data is replicated periodically to the target region. This doesn't affect the source VM. >* Resource Move generates ARM templates for the other source resources. >* After preparing resources, they're in an **Initiate move pending** state. ![](https://i.imgur.com/dY5j2c6.png) 2. Initiate the move * In **Across regions**, select resources with state **Initiate move pending**. Then click **Initiate move**. ![](https://i.imgur.com/SHekYmj.png) * In **Move resources**, click **Initiate move**. ![](https://i.imgur.com/2DdfZjQ.png) >* For VMs, replica VMs are created in the target region. The source VM is shut down, and some downtime occurs (usually minutes). >* Resource Mover recreates other resources using the ARM templates that were prepared. There's usually no downtime. >* After moving resources, they're in a **Commit move pending** state. ### Step 9: Discard or commit? >After the initial move, you can decide whether you want to commit the move, or to discard it. > **Discard**: You might want to discard a move if you're testing, and you don't want to move the source resource. Discarding the move returns the resource to a state of **Initiate move pending**. > **Commit**: Commit completes the move to the target region. After committing, a source resource will be in a state of **Delete source pending**, and you can decide if you want to delete it. 1. Commit the move * In **Across regions**, select resources with state **Commit move pending**, and click **Commit move**. * In **Commit resources**, click **Commit**. ![](https://i.imgur.com/BKZwssz.png) >* After committing the move, VMs stop replicating. The source VM isn't impacted by the commit. >* Commit doesn't impact source networking resources. >* After committing the move, resources are in a **Delete source pending** state. ![](https://i.imgur.com/bWdh23k.png) ### Step 10: Configure settings after the move * The Mobility service isn't uninstalled automatically from VMs. Uninstall it manually, or leave it if you plan to move the server again. * Modify Azure role-based access control (Azure RBAC) rules after the move. ### Step 11: Move the SQL Server >Assign a target SQL Server in the target region and commit the move. 1. Assign a target SQL Server * In **Across regions**, for the SQL Server resource, in the **Destination configuration** column, click **Resource not assigned**. ![](https://i.imgur.com/PGNB81V.png) * Select an existing SQL Server resource in the target region ![](https://i.imgur.com/Ancn8x2.png) >The source SQL Server state changes to **Commit move pending**. ![](https://i.imgur.com/MqI8UlG.png) 2. Commit the SQL Server move * In **Across regions**, select the SQL Server, and then click **Commit move**. ![](https://i.imgur.com/SWE9Z2e.png) * In **Commit resources**, click **Commit**. ![](https://i.imgur.com/ujD0h90.png) * After the commit, the SQL Server is now in a **Delete source pending** state. ![](https://i.imgur.com/Eh1Ievf.png) 3. Prepare resources to move >With the source SQL Server moved, you can prepare to move the other resources. * Prepare an elastic pool * In **Across regions**, select the source elastic pool, and then click **Prepare**. ![](https://i.imgur.com/B92dpwz.png) * In **Prepare resources**, click **Prepare**. * When notifications show that the preparation process was successful, click **Refresh**. >The elastic pool is now in an **Initiate move pending** state. ![](https://i.imgur.com/BJ4uq2q.png) * In **Across regions**, select the source **elastic pool**, and then click **Initiate move**. * In **Move resources**, click **Initiate**. * When notifications show that the preparation process was successful, click **Refresh**. * In **Across regions**, select the source **elastic pool**, and then click **Commit move**. ![](https://i.imgur.com/RVBV0KS.png) * In **Commit resources**, click **Initiate**. * When notifications show that the preparation process was successful, click **Refresh**. ![](https://i.imgur.com/hCMs9Xy.png) >The elastic pool is now in a **Delete source pending** state. ![](https://i.imgur.com/ioLEX9j.png) 4. Prepare a single database * In **Across regions**, select the single database (not in an elastic pool), and then click **Prepare**. ![](https://i.imgur.com/BmEfwrz.png) * In **Prepare resources**, click **Prepare**. * When notifications show that the preparation process was successful, click **Refresh**. ![](https://i.imgur.com/Yprk7jy.png) >The database is now in an **Initiate move pending** state and has been created in the target region. ![](https://i.imgur.com/S2rLNoA.png) 5. Move databases >Start to move the databases. * In **Across regions**, select resources with state **Initiate move pending**. Then click **Initiate move**. ![](https://i.imgur.com/dCaMxAA.png) * In **Move resources**, click **Initiate move**. ![](https://i.imgur.com/qFuyo1y.png) >Databases are now in a **Commit move pending** state. ### Step 12: Discard or commit? >After the initial move, you can decide whether you want to commit the move, or to discard it. > **Discard**: You might want to discard a move if you're testing, and you don't want to move the source resource. Discarding the move returns the resource to a state of **Initiate move pending**. > **Commit**: Commit completes the move to the target region. After committing, a source resource will be in a state of **Delete source pending**, and you can decide if you want to delete it. 1. Commit the move * Check that the SQL Server is a **Commit move pending** state. * Update database connection strings to the target region, before you commit. * In **Across regions**, select the SQL resources, and then click **Commit move**. * In **Commit resources**, click **Commit**. ![](https://i.imgur.com/kkDVZDn.png) >Some downtime occurs for SQL databases during the commit process. Committed databases and elastic pools are now in a **Delete source pending** state. After the commit, update database-related settings, including firewall rules, policies, and alerts, on the target database. ![](https://i.imgur.com/IDNVLYm.png) ### Check the resource moved or not. 1. Move to the resource group **ResourceMoverRG-eastus-eastus2-eus2** ![](https://i.imgur.com/TAsYEf7.png) 2. Move to the resource group **Mover-eastus2** ![](https://i.imgur.com/PTwQOtf.png) ## Cleanup resources 1. Delete source resources after commit >After the move, you can optionally delete resources in the source region. >* A few resources, for example, **key vaults** and **SQL Server servers**, can't be deleted from the portal, and must be deleted from the resource property page. >* **SQL Server servers** can't be deleted from the portal, and must be deleted from the resource property page. * In **Across Regions**, click the name of the source resource that you want to delete. * Select **Delete source**. ![](https://i.imgur.com/ETBt9B8.png) ![](https://i.imgur.com/gsUlGFs.png) 2. Delete additional resources created for move >After the move, you can manually delete the move collection, and Site Recovery resources that were created. * Locate the resources in resource group ResourceMoverRG-eastus-eastus2-eus2. * Check that all the **VM** and other source resources in the source region have been moved or deleted. This ensures that no pending resources are using them. ![](https://i.imgur.com/L1N8y0I.png) ![](https://i.imgur.com/PmGdSBV.png) ![](https://i.imgur.com/uRXPlCY.png) ## Conclusion In this lab, You learn how to: 1. Check prerequisites and requirements. 2. Select the resources you want to move. 3. Resolve resource dependencies. 4. Prepare and move the **SQL Server** to the target region. 5. Prepare and move databases and **elastic pools**. 6. Decide whether you want to **discard** or **commit** the move. 7. Optionally remove resources in the source region after the move. 8. Prepare and move the source resource group. 9. Prepare and move the other resources.