This blog describes how to streamline the migration journey for Microsoft Azure web workloads across your application and relevant databases. By taking advantage of Azure Migrate, the Azure App Service Migration Assistant, the Data Migration Assistant, and Azure Database Migration Service, we simplify the migration of your web apps and databases to Azure with minimal or no code changes.
Parts Unlimited is a sample eCommerce website site built on .Net Core 2.0. The site includes a front-end ordering page, a mobile experience, an order database, and a variety of other common eCommerce features. The application features a modern HTML5 responsive layout using bootstrap for mobile, tablet, and PC. It supports multiple authentication options including Azure Active Directory, Google, and Facebook. At the same time, it leverages a variety of Azure App Service features including testing in production, staging slots, and environment variables for feature flags (to turn on/off recommendations). The site works with Visual Studio 2017 and includes a docker file and sample publishing profile to deploy as a docker container.
The application that will be migrated is hosted on a Windows server 2012 running Internet Information Services (IIS), while the database is hosted on a computer running SQL Server 2017.
You can find a repo with the site code here: http://aka.ms/pulabs
Migrating to the cloud involves moving your web apps and databases, and there are different tools and techniques for each. However, the typical migration journey consists of four phases: pre migration, migration, post migration, and optimization.
During pre-migration, you:
During migration, you migrate the application and your schema and data, as well as any other server objects (such as logins, SQL Server Agent jobs, and SSIS packages) upon which your application depends.
During post-migration, you:
Finally, during optimization, you perform continuous evaluation and refinement. The goals of optimization are to:
With this high-level road map of the migration journey in place, let’s take a look the details associated with the process associated with migrating applications and the databases supporting them.
The first step in the migration journey is to “discover” the servers hosting the application and databases to determine if there are the dependencies that would require migrating these entities to Azure together.
You can use Azure Migrate to assesses on-premises workloads for migration to Azure. The service discovers and assesses the migration suitability of on-premises virtual servers and servers running SQL Servers. Azure Migrate sizes things based on performance and provides cost estimations for running on-premises computers in Azure.
You can also use the Microsoft Assessment and Planning Toolkit (the "MAP Toolkit") to assess your current IT infrastructure for a variety of technology migration projects. This Solution Accelerator provides a powerful inventory, assessment, and reporting tool to simplify the migration planning process.
For the Parts Unlimited application, we already know the application and database servers and their respective dependencies, so we skip the discovery process for purposes of this blog post. Both the application and SQL Server database are hosted on a server named “SQL2017.redmond.corp.microsoft.com”.
Azure App Service is an HTTP-based service for hosting web applications, REST APIs, and mobile back ends. Migrating applications to App Service is a relatively simple process that involves:
To begin the assessment, navigate to the Assess your site page, type in the public facing URL, and then select Assess:
App Service doesn’t rely on a static (and potentially outdated) list of supported technologies. Instead, App Service compares a dynamically generated list of technologies used by the site being scanned to similar lists for sites that are already hosted on App Service to generate a uniquely accurate assessment report. A positive assessment for a given technology guarantees that at least one customer on the platform is already using that technology.
Consider the following example.
Note: Use the Show more technologies detected for the site toggle to see additional detail about the technologies in use on the site.
After you successfully assess your site, on the Assess your site page, select Start Migrating Now! or navigate to the Download the Migration Assistant for your .NET and PHP Apps page, and then select Download.
When the download and installation is complete, start the App Service Migration Assistant.
The Migration Assistant is a local agent that performs a detailed assessment and then walks you through the migration process. The tool performs readiness checks, as well as a general assessment of a web application’s configuration settings.
After the readiness checks are complete, review the Assessment Report, considering any warnings and resolving any errors that may have been identified. When and the Assessment Report for the application shows no Errors, the Migration Assistant walks you through the process of authenticating with your Azure subscription and then prompts you to provide details of the target account, together with other configuration details for the newly migrated site.
When you have entered the appropriate detail, select Migrate, and the Migration Assistant then moves your site to the target application in App Service.
The Migration Assistant is designed to migrate most modern ASP.Net and PHP applications, but it does not support all configurations. For more details about what the tool supports, together with workarounds for some unsupported sites, see the App-Service-Migration-Assistant wiki in GitHub. You can also find more details about App Service migrations on the App Service Migration checklist.
While the Migration Assistant is designed to migrate web applications and their associated configurations, it will not migrate databases. For migrating databases to Azure, use Azure Database Migration Service.
Note: To continue running databases on-premises rather than in the cloud, specify that the Migration Assistant set up hybrid connections during the app migration process. Then, use the hybrid connections to connect cloud-based applications with on-premises databases.
Before you begin database migration, use the Data Migration Assistant to assess your on-premises SQL Server database, PartsUnlimitedDB, and then upload the results to the Azure Migrate Hub for a report on the readiness for migrating to SQL Database. Step-by-step guidance is available here.
The Azure Migrate assessment shown below recommends the preferred target, a SQL Database managed instance, for the PartsUnlimitedDB database:
When you perform database assessment using Data Migration Assistant, make sure to select the databases in Data Migration Assistant for schema migration and extended event traces for assessing any ad hoc or dynamic queries or any DML statements initiated through the application data layer. Step-by-step guidance provided here.
If you plan to migrate any SQL Server Integration Services (SSIS) packages, be sure to assess the SSIS packages at first to understand if any mitigation steps required. Step-by-step guidance is provided here.
It is critical to identify both the minimum recommended target SKU of SQL Database single database or managed instance based on performance counters that are collected from the computer(s) hosting your databases. This information helps to ensure that you have an optimal post migration experience. The Azure Database Migration Service SKU recommendations feature provides recommendations related to pricing tier, compute level, and max data size, as well as an estimated cost per month. The feature also provides the ability to bulk provision single databases and managed instances in Azure for all recommended databases. Step-by-step guidance is provided here.
Below is the html report generated for SQL Server hosting the PartsUnlimitedDB database for the workload data collected during the peak-time activity for migrating to a SQL Database managed instance.
The Data Migration Assistant target SKU assessment recommends using at least a 8 vCore, General Purpose Gen 5 SKU, which has an estimated monthly cost of ~$1K with Azure Hybrid Benefit (HBU).
Next, select Generate Provisioning Script to create the PowerShell script that will help you provision the target SQL Database managed instance. Alternately, you can create a SQL Database managed instance by using the step-by-step guidance here.
Azure Database Migration Service is a fully managed service designed to enable seamless migrations from multiple database sources to Azure Data platforms with minimal downtime (online migrations). You can migrate the PartsUnlimitedDB database to a SQL Database managed instance with minimal downtime using a few simple steps:
Step-by-step guidance is provided here.
Note: Be sure to monitor the migration status and wait until the database cutover completes.
In addition to migrating the databases, you also need to migrate any artifacts (server objects) outside of the databases (such as database logins, ETL jobs, etc.) on which your applications depends.
Parts Unlimited users access the database layer by using both SQL Server logins and Windows logins. You must migrate the SQL Server logins as is and map the Windows logins to Azure AD logins along with securables, privileges, and group memberships. You can use Azure Database Migration Service to migrate both SQL Server and Windows logins.
The logins migration feature is enabled in the SQL Database managed instance offline (one time) migration workflow. Step-by-step guidance is provided here.
Note: When migrating the Windows logins, be sure to enable the Windows logins migration setting in the Settings\Configuration page, as shown below.
Migrate SQL Server Agent jobs
Use Azure Database Migration Service PowerShell commandlet options to migrate SQL Server Agent jobs from on-premises SQL Server to a SQL Database managed instance. See the command-line options provided here, in the topic “Select agent jobs” for guidance.
Migrate SQL Server SSIS packages
To migrate any SQL Server Integration Service (SSIS) packages, follow the steps here. First assess source SSIS projects and packages, and then migrate these packages and projects as they qualify the migration.
Change the connection string
Login into Azure portal, and then open the app migrated to Azure. On the TOC blade, enter edit as shown below, and then select App Service Editor (preview).
Change the connection string in Web.config file as below.
Then launch the PartsUnlimited application to ensure that it properly connects to newly migrated database in SQL Database managed instance.
After you have successfully migrated your application and any databases, you need to go through a series of post-migration tasks to ensure that everything is functioning as smoothly and efficiently as possible.
For the databases specifically, after the data is migrated to the target environment, remediate the objects with the fixes proposed by the Data Migration Assistant for the objects reported in the Breaking changes section. Also be sure to perform functional and performance tests. Optimize the target SQL Database managed instance as needed to meet the expected response times.
For assistance with fine tuning SQL Database managed instance, refer to the following resources:
After you complete your post migration verification, it is important to use an iterative optimization process to ensure the best performance and functionality of your solution in the target environment.
For additional information, refer to the following resources.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.