TSM - Migrating MVC 3 website and DB to Azure (II)

Dragoș Andronic - CTO

A brief review of the previous article (part 1):

We were given a "classic" web architecture: an ASP.net MVC 3 & 4 web portal, backed up by a MS SQL database with Entity Framework as a ORM.

This architecture had to be prepared for scaling - ported to a system that would allow for a high number of requests to be served.

After analyzing multiple upgrade options (the full reasoning can be read in the previous article) we decided on SQL Azure and Windows Azure as a migration platform.

In this article we will go, step by step, over the database migration procedure, what tooling we did use and what problems appeared or could appear.

The database migration

The database was accessed through Entity Framework - this made our job considerably easier as one of the roles of an ORM is transparency regarding the chosen database.

The first thing we have to do is to check if the SQL Azure and SQL server databases are compatible - what can be migrated "as it is", what has to be changed and what cannot be migrated.

A good place to start documenting ourselves is the Windows Azure General Guidelines and Limitations. If you are dealing with an enterprise database then you have to go over the whole article, otherwise it is enough if you know that the following are not supported by Windows Azure:

If you like a little less theory and a more practical approach, you can attempt a migration with one of the migration tools and, in case incompatibilities are detected, all the tools will provide you a detailed report.

Migration tools

Ok, what can we use to migrate our SQL database to SQL Azure?

We used SQL Management Studio 2012 - as Bizspark member we had free access to it.

The migration procedure, step by step:

Migration validation

After the migration is done, to check that everything works correctly we change the connection string in our web project to point to the SQL Azure database. We start up the project and either run some database unit tests or manually go over some basic scenarios. Due to the fact that we have Entity Framework, everything should work as expected, no other change being required.

Final thoughts

That"s about it regarding the database migration. If you encounter problems during your migration or have questions you can contact me directly at dragos(at)txtfeedback.net

In the next article I will go over how we moved our website & virtual directories structure to Azure.