Moving your SQL Database to Azure
In this section, I will show you how to port your SQL Database from your old ISP to Windows Azure.
- Log onto Windows Azure using your Windows Live ID. If you don't already have an Azure account, please
read the previous section.
- Click on Manage.
- Click on "Database" (on bottom left of screen)
- On the top left pane, click on the Subscription to which you want to add an SQL Database
- Click “Create” (on top menu)
- Select the same Region you chose for your website in the previous section, and click on "Next".
- Create the administrator login you want to use to access the database.
- You will be prompted to add firewall rules. These rules will define which remote machines are allowed to directly access this SQL role.
You will want to access SQL from your development machine and also allow your Web Role instances to access the SQL server.
Click on Add; the resulting dialog will show your current IP address. Add the Rule name “local development environment”, and enter your IP address twice. Click on “OK”.
- Click on “Allow other Windows Azure services to access this server
- Click on ”Finish”. You will now see a “Fully Qualified Server Name”; write this name down so you can use it later for your connection string.
- At this point, we have setup a "Database Server", but we still need to create an actual database so we can
put data in it (I strongly recommend against putting your new tables in the “master” database which has been created for you).
Click on the second "Create" button on the top of the screen, and enter a name for your database.
Here is an article describing the
differences between SQL Azure web and business editions.
- Download Sql Azure migration wizard from: http://sqlazuremw.codeplex.com/.
Extract and run the Sql Azure Migration tool to move your schema and tables to Azure; make a note of any errors the tool generates.
IMHO, this is a truly amazing bit of programming. If you have developed your web application on older versions of SQL Server, some of the
features you have used may have been deprecated. Also, I have found that
choosing the "Specify database" is a better option than "Master DB (List all
databases)". This article discusses the differences between SQL Server and SQL Azure
- Next, navigate to your new database in the left hand pane.
On the left pane, you will see the text "Connection Strings". Click on "View" to see your connection string.
- Put this connection string into your web.config file, and publish your Web Application to Azure.