Creating an On Premise Database and MVC Web Application and Migrating to Windows Azure and SQL Azure-Step 5 of 10

Previous Posts that you should review


Step 1



Step 2



Step 3



Step 4




SQL Azure
We will migrate our database to SQL Azure in this post. There are many reasons why SQL Azure is a good idea.


Microsoft® SQL Azure™ (formerly SQL Server Data Services and later SQL Services) Database is a cloud-based relational database service built on Microsoft SQL Server® technologies


It provides a highly available, scalable, multi-tenant database service hosted by Microsoft in the cloud


SQL Azure Database helps to ease provisioning and deployment of multiple databases. Developers do not have to install, setup, patch or manage any software


High availability and fault tolerance is built-in and no physical administration is required. SQL Azure Database supports Transact-SQL (T-SQL). Customers can use existing knowledge in T-SQL development and a familiar relational data model for symmetry with existing on-premises databases



Navigate to

The portal
The SQL Azure Portal allows you to manage your database. Note that the server name of my particular database is Your database will have it’s own address.



The ‘master’ database is always there 

stocksdb was created by click on ‘Create Database’
Before you can move your data from on-premise to SQL Azure, you will need to have a database ready to accept the data.



‘Create Database’ can be used 

Options for a business user

Notice that the business edition gives you several options in terms of the ‘size’ of the database you want.



Take note of the server name

Needed in connection string
In the next blog post we will need to adjust our connection string so that our data comes from SQL Azure.

bullet is the name of our server. Yours will be different.



SQL Azure Migration Wizard

Found at CodePlex
The URL is



Analyze and Migrate 

Migrating the SQL Database
Select SQL Databaes below.



The ‘source’ of our data

localhost is the local ‘on-premise’ version of our database. We are selecting the data that we want to copy to SQL Azure.



Choose the data that you want to migrate

The data is moving to the cloud
By selecting StocksDatabaseOnPremiseDb we are identifying the database that we wish to push to the cloud.



Narrowing down the data to migrate 

You don’t need to migrate ALL the data
In this case, we only have one table and a stored procedures that we wish to migrate. We are choosing ‘Script all database objects.’



Generating the SQL Script

Purpose of script
The SQL script that we generate will be used to migrate data. Clicking ‘Yes’ followed by ‘Next’ will take us to the next step. We will need to select a target database shortly.

snap0102 snap0103


Connecting to SQL Azure

Verify your Server Name
At this stage we wish to identify where we want to put our data. We have already identified the source. Now we need to identify the target. This is where you type in the server name that you got from the SQL Azure Portal.



Choosing the target database

Previously, when we were at the portal, we created a database called ‘stocksdb’

It is a simple case of going to the AQL Azure portal and clicking ‘Create Database’ and then giving the database a name of ‘stocksdb’

image snap0106 snap0107



Using SQL Server 2008 R2 Management Studio 

Verifying our data migrated successfully
The good news is that SQL Server Management Studio can be used with SQL Azure. This is a big deal and many of my audiences loved that this is true.



New Query Editor Window 

Right click on dbo.Stocks
We will just illustrate a ‘select’ statement.

snap0110 snap0112

We have completed this post.

Future Posts

MVC App still needs to be put in the cloud
We have succeeded in putting the data in the cloud, but our application (MVC Web App) still needs to be migrated. that is the subject of future posts.

Comments (0)