In this tutorial, you will learn how to install and hook up a SQL database to an Umbraco website hosted within Azure. In How To Setup Umbraco With Azure - Part One - Configuring Azure I covered the basics of setting up an environment in Azure and then using Visual Studio to publish your files to that environment.  If you tried to run the site you would have bumped into an issue...  the database would have been empty.  The first part of this guide will step you through uploading your Umbraco database.  

SQL Azure Overview

First, I'll quickly start by pointing you to the main areas you might care about in Azure:


If you are unsure about the connection string you need to use in your application to point to an Azure database, in the Azure portal if you open up your SQL database you will find the 'connection strings' link.  Clicking on that will show you what you need to use.

I've found the easiest way of managing an Azure database is through SQL manager on your PC.  TO get this to work you will need to add your IP address to your SQL instance (not the database) Firewall.  This can be done by opening up your SQL instance within the Azure portal, and clicking 'Firewall'.

In here, make sure 'Enable access to Azure services' is enabled, then use WhatsMyIp address to add your IP.  Now you know how to get the connection string for your database and how to allow your PC to access that database via SQL manager, we can upload your database.  Remember, this approach is based on you creating your Umbraco website locally and then copying it into Azure after you have finished.  Which, from my experience is how most developers tend to work.

Uploading Your SQL Database 

We will upload your SQL database using SQL manager.  First, you will need your Azure connection string details.

If you followed my last tutorial, you will have all your SQL server, resource group etc.. set-up.  You will also have a blank database. After connecting to Azure, delete it, because in a minute we will upload one from your PC that you will want to use as your live database.

Now, I'm assuming you have the Umbraco database you want to use on your PC.  Next, connect to your SQL instance, locate it within the tree in SQL manager, right-click on it, select 'Tasks' -> 'Deploy Database to Microsoft Azure Database'

When you are finished click 'Next'.

First, pass in your database name within the 'New database name'.  Next, you need to connect to your Azure instance, clicking the 'Connect' button.  

Add in your Azure details and click 'Connect'.

Click 'Finish' and your database will be uploaded from your PC into Azure.  As long as your connection string within your web application is pointing to your Azure database, you should now have a working website!  

Backing Up Your Umbraco Azure Database 

Before you leave, it might be good to talk about backing up your database from Azure.  The easiest way is still via SQL manager, export the database as a 'bacpac' file.

Within SQL manager, connect to Azure, right-click on your database, click 'Tasks' and select 'Export Data-tier Application'.  

Pick a location to save your back-up file to.

Click 'Finish' sit back and relax...  your Azure Umbraco database has been backed-up!