Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

10. How to migrate the SQL database to Azure with the Azure Database Migration Service

David Sanz edited this page Dec 5, 2017 · 3 revisions

Overview

In cases where we have our SQL databases on-premises and we want to migrate them to Azure, we can do it in a simpler way than manually with the Azure Database Migration Service. The service is analyzing our on-premises databases and providing information in every step of the process in case we want to customize one specific step.

Goals for this walkthrough

Show you the basic steps to migrate an on-premises database to Azure with the Azure Database Migration Service (ADMS). The process will the explained in detail using the Microsoft Data Migration Assistant, which is part of the ADMS and allows us to do the whole process. In addition, the other options of using this service will be exposed.

Migration of on-premises SQL Server database with Microsoft Data Migration Assistant

In the cases where your on-premises database is not reachable from Azure, and you do not want to create an Azure VPN, you can use the Azure Database Migration Assistant (ADMA). You can download it directly from the microsoft web page. There is a link as well in the migration steps of the Azure Migration service:

Install ADMS

1. Create migration

Once installed and started the tool, select create a new process:

Create migration

In the options select Migration, give a name to the migration project and then select the source and target types. In our case we are migrating from a SQL Server to Azure SQL Database.

2. Configure source

In this screen we add the configuration to connect to our source SQL database:

Select source

3. Select target

Now we put the data of our Azure SQL Database. In case that we do not have it already created, the link Create a new Azure SQL Database... is provided to get more information about how to create one. Write the server name and the connection credentials, and the select the target database, in our case we have named in eshop-modernized-migrated:

Select target

4. Select objects

The assistant will process the information and then we will select the 'objects' to migrate. In our case we want a full migration. If there is any issue for the migration of any object, it will be shown in this step.

Select objects

Click Generate SQL script to create the database schema.

5. Script & deploy schema

The assistant gives us the option to modify the script for the schema generation. Once we are ready, we click Deploy schema to deploy in the target Azure SQL database.

Deploy schema

6. Migrate data

Click migrate data to configure the data to migrate:

Migrate data

Select the data tables Which must be migrated:

Data selection

Once ready click Start data migration.

7. Migration completed

Once the process is finished, we will see the results about the whole migration

Migration completed

After this step we have successfully migrated our on-prem database to Azure.

8. Change the connection string

When we have finished the process, we are ready to use the database in Azure. For eShopModernizing we just need to change the connection string to the new one. Go to the Azure SQL database, and in the Overview tab select Show database connection strings. Once there, copy the connection string and change it in the variable in eShopModernizing

Database migrated

Yo can write the connection string in the .env file if you are using Docker Compose. Uncomment the ESHOP_AZURE_STORAGE_CONNECTION_STRING line removing the # character and put the connection string value. For the other cases (Kubernetes, Service Fabric or Virtual Machines) you can follow the other sections of this wiki where we explain how to configure each environment.

env file

Alternatives to the assistant

In the previous guide we have installed the migration assistant in one of our on-premises machines to do the whole process. This is convenient in cases when we do not want to connect our database to Azure, but this forces our servers to do the whole processing. On the contrary, the Azure Database Migration Service does the whole process in the cloud for us, but we need to give visibility to our on-prem databases from the Azure resources.

Migration service

The service works as the Data Migration Assistant, we have to create a New migration project and then select the options as with the assistant.

Migration service 2

In this case the process is being done from the Azure service, so for the source server name we have to put one SQL server visible from Azure. This can be achieved for on-premises servers using either Azure VPN or Azure ExpressRoute.

Clone this wiki locally