Well, the first thing to migrate a Database to Azure SQL, is actually having a DB to migrate, so, in this example we will use a local Database in a SQL Express as the source (with sample data, credits to https://www.sqlservertutorial.net/load-sample-database/ ) and the DB created in here as target.
In the point that we have an actual DB the migration process starts by installing Azure Data Migration Assistant (https://www.microsoft.com/en-us/download/confirmation.aspx?id=53595 )
But… in this example we will use Data Migration Assistant instead of Azure Database Migration Service, because we can accommodate a little downtime, while with the “Service” migration type we have a very little downtime.
First step, make an Assessment
At this point, the migration starts to get hot, open the Microsoft Data Migration Assistant and hit the “+” button to create a new project.
First thing to do is an Assessment, so we will give it a name to the project and check the assessment radio button, and check the source and target server types, as the image shows.
The next step we will check the options for the assessment, compatibility and parity in my case.
Now, create a connection to the source server, just putting the correct data in the gapes, like this image.
When the DMA connect to the server, check the DB to migrate.
Now, hit the start assessment button to start the assessment process.
When the assessment completes it will show us the possible problems for the migration, and some links to resolve this.
Once the problems are solved, we can click the Upload to Azure Migrate button.
The Wizard will ask for the Azure Credentials to connect, so give them to it, and when correctly connected to our Azure tenant it will ask for the Subscription and the Azure migrate projecto to upload to Azure.
It will create a notification when the Assessment is uploaded.
Now, in the Azure Portal Search bar we will search for Azure Migrate and then, in the left column search for Databases (only) and it will show the migrationtest project that we just created, as in the image.
If we click in the Assessed databases (for example), this will show the status of the DB, size, readiness for migration, etc.
Once the assessment is complete, and the (possible) problems solved, we can create the migration project, the same as we did before, but checking the Migration radio button in the project.
Let’s go to Data Migration
Now open again the Microsoft Data Migration Assistant, and go for the Migration radio button.
First thing to do is connect to the source SQL Server.
Then, select the DB to migrate, you can see that this DB can be Assessed before the migration, in our case, we assessed this before so I will uncheck this.
In the target section, we will hit the Create a new Azure SQL Database link, like the screenshot, and this will take us to the Microsoft page explaining step by step how to create an Azure SQL Database.
Now we enter the Servername\instance of the Azure SQL we created.
Select the DB we created earlier to do the migration.
In the next step we will select the objects to migrate and Generate the SQL script.
The DMA will generate the scripts for the deployment, like the following image, in this case we will save the scripts, just for backup, and hit the Deploy schema button at the lower right.
Now we’ll see the progress of the deployment.
Once this is done, we can hit the Migrate Data to start the migration.
When the DMA is done collecting the tables, we have to check the tables we want to migrate data from and click on Start Data Migration so the process can start.
It will take some time, depending on the data, but it will finish (hopefully) like this, with no errors.
Now we can check if the DB data migrated correctly by connecting to the DB with Azure Data Studio, with the right connection parameters.
When the connection is made, we can navigate and run queries so we can see if the data migrated correctly, as we can see in the image following.
Once we see the data of the Database correctly, we will be assured that the migration has completely and succesfully terminated, now the only thing remaining is connect the the app to the new DB with the connection strings and welcome to the cloud computing databases!