- Coming up, we resume part two
on our series on Azure migration.
We will help you rehost your app in Azure,
this time with a focus on database migration
and managed PaaS service.
With PaaS, you don't need to worry about managing
or configuring your database environment.
You can take advantage of hyper scale, high availability,
as well as built-in security.
I'll show you how you can migrate your database
using Azure Database Migration Service.
This service allows you to migrate databases
such as Oracle and SQL Server 2005 and newer.
In this case, we'll use the DMS service
to migrate SQL Server on premises
Azure by deploying to SQL Managed Instance
with zero code changes.
This is a new capability in Azure,
provides near 100% compatibility
with your on-premise SQL servers.
I'll show you how to do this using a sample application.
In this example,
I have a hotel registration app
that keeps track of customers checking in
and checking out.
The app is running in a VMWare environment on premises,
has one database,
as well as a couple of web app servers.
Any migration involves three phases:
assessment, migration, and optimization.
To plan a migration, I've already done my assessment
using the Azure Migrate service for my environment.
This discovers the servers and application dependencies
in my environment,
gives me insights and recommendations to plan my migration.
If you're new to Azure Migrate,
you can learn how to use it
in our previous MI migration episode.
In the Azure portal, I can open the Azure Migrate service.
And if you see, my Smart Hotel Migration project
here from my on-premises discovery.
I've grouped the resources for my application.
I've named it hotelsapp.
I'll open the group and view the dependencies of the app
in Azure Migrate.
It consists of three servers:
one SQL database and two web servers.
I'll close the dependency view.
Now let's look at the Azure Migrate assessment.
In the assessment, I'll drill into the Azure readiness view.
For each of the servers in my application,
I get a suggested tool for how to migrate.
It's recommending the Azure Database Migration Service
to migrate my SQL Server database to Azure.
So let's move over to the DMS Service
to walk you through the steps.
There are for steps to this.
First, we create an Azure Database
Migration Service instance.
Second, we create a migration project
within the migration service.
Third, we'll execute the migration activity,
and finally, we'll reconnect our app to Azure SQL MI.
From the Azure portal,
I'm going to create a new DMS service.
I'll use the create a resource command.
I'll search for the DMS service,
I'll select it,
and then create it.
I'm prompted to give the service a name.
I'll name it HotelDBMigration.
Next, I'll create a new resource group
to place my DMS resources.
I'll choose an existing virtual network.
Now, this is the most important part
of the DMS service creation.
DMS will use this virtual network
to connect to your on-premises SQL server
and the target in Azure.
If you want to learn more about how to do that,
you can go to the link shown.
We've outlined four different network topologies
that you can use to configure your DMS service.
Today I'll focus on the hybrid configuration.
In this configuration,
well, DMS and MI share the same VNET,
but they're in two different subnets.
This VNET is also connected to your on-premises environment
by express route or VPN.
We've also documented the NSG rules and the specific ports
that need to be enabled at the firewall.
Next, I'll choose the size of my DMS services.
To help you select the right DMS size
for your migration needs,
you can get the guidance at the link shown in the wizard.
In this case, I'm gonna keep it simple
and use one core for my migration.
Now, I would hit create,
but because this will take a few minutes to complete,
I'm going to use a DMS service that I've already created.
And to save time, I'll also use an existing project
named SmartHotelsDBOne to perform the migration.
You can get more guidance
on how to create a migration project
within the migration service at the link shown.
This brings us to step three,
which is to run the migration
by creating a new activity.
The migration is pre-populated
with the server name from the project.
So I'll just enter the credentials and save.
Make sure to provide a FQDN or IP address
where DNS resolution is not possible for the source server.
I'll provide the credentials for the target
MI instance here.
And the DMS server will connect to the instance in Azure
and make sure the user has the right permissions
to perform the migration.
I'll select the database I want to migrate.
I can also select multiple databases for parallel migration.
I next need to provide the migration configuration.
For this process to work,
DMS will initiate the source database backups
and store those backup files in the SMB network share
configured in DMS.
DMS will then upload those backup files
to Azure storage Blob container
by using the Windows credentials you provide.
Finally, DMS will use those backup files
to restore the databases
in the target Azure SQL MI instance.
Now let's look at the SMB network share
for the backup files I've set up in advance
on the source SQL server.
First, let's look at the SQL server account
and SQL server configuration manager.
In this case, core/SQL service.
Now, on the backup file share location,
you'll need to make sure
that the account has read-write permissions
on the network share.
Additionally, the Windows account
that we provide in the migration configuration
must have read-write permissions for this folder as well.
Now back to Azure Database Migration Service.
I enter the network share here,
and I enter the Windows user credentials,
Corp Administrator, and the password.
Now I'm ready to create a SaaS key
that provides access to an Azure storage container
and set the permissions.
Let me show you how to generate the SaaS key.
I'll open the storage accounts
and click on the existing storage account, 360regDemo.
I'll use the storage explorer to see my Blob containers.
Right click on the container
and then click get shared access signature.
Then I'll select all permissions.
Now, I just need to set the expiration to a future date,
click create,
and copy the SaaS key to use in DMS.
Back in the migration configuration blade,
I paste the SaaS key here.
Once I click save,
Azure DMS will validate the migration configurations.
To complete, I just need to provide an activity name
for my migration.
I'll select my validation options.
The query validation option
replays the top-10 queries collected from the source
on the target and provides a report.
In the interest of time, I'm going to skip the validations.
Lastly, I'll run the migration.
Here in the status view,
you can keep track of the migration activity
and refresh to track progress.
I'll select the database object and track the progress.
It will take a few minutes to complete.
As you can see, the database migration is completed,
and our final step is to reconnect our app
to Azure SQL MI.
To do this, we need to switch the connection string
in the web app servers
to point to the new target MI database.
Here is the existing config file that connects
to the on-premises SQL server.
I'll swap that file to an updated version
that connects to the target MI instance.
To complete this,
I'll use PowerShell to update the files and the VMs
in Azure using this script.
And now that the connection is updated,
I can go ahead and shut down the on-premises database server
SHSQLDB01 on VMWare.
Just like that I'm no longer running my application database
on premises.
I'll now go back and verify that my app works as expected.
It's now pointing to Azure VMs and database
in Azure SQL MI.
As you can see, it's running again
but now powered by Azure SQL Database Managed Instance.
It's literally back online with zero code changes.
So that was an overview of how you would migrate
your app to Azure,
with a deep dive of migrating your database
from SQL Server to Azure SQL MI
using the Azure Database Migration Service.
To see more episodes in the Azure Migration series,
check out the link shown.
And to learn more, visit the Azure Migration Center.
Thanks for watching.