SQL SERVER – Backup to Azure Blob using SQL Server 2014 Management Studio

Recently, while working on a demo about backup, I realized that in management studio, now there is a new option in the backup screen called a URL. This feature is called as “backup to URL”.

I checked earlier version of SSMS and found that this was not there in the SQL 2012 management studio. There the options were “disk” and “tape” in SSMS 2012.

SQL SERVER - Backup to Azure Blob using SQL Server 2014 Management Studio azurebackups1

As soon as the URL is selected, it would ask for various options about backup destination in Azure.

SQL SERVER - Backup to Azure Blob using SQL Server 2014 Management Studio azurebackups2

Let’s go step by step and take a database backup to Microsoft Azure Blob storage.

To use this feature, you need to have is a Microsoft Azure account. If you do not have a Windows Azure account, visit Windows Azure 3-Month free trial. After logging it to the portal, I have created a “storage” called sqlauthority.

SQL SERVER - Backup to Azure Blob using SQL Server 2014 Management Studio azurebackups3

Under sqlauthority, I have created a container called “backup”. This container was created as “Public Blob”.

SQL SERVER - Backup to Azure Blob using SQL Server 2014 Management Studio azurebackups4

If we closely look at URL it is http://<StorageAccount>.blob.core.windows.net/<ContainerName> Going back to SSMS, this is what we have to provide. But wait, how would SQL Server connect to Azure Blob storage? Well, that’s where the credential comes into the picture. Note that authentication to the storage account is required for SQL Server backup and restore even if we choose to create a public container. There are multiple ways to connect to the storage – publishing profile, certificate or SQL Credential. To use SQL credential, we need to get the secret key from the portal using below the screen. The screen would appear once we click on “Manage Access Key” in the third image of this blog.

SQL SERVER - Backup to Azure Blob using SQL Server 2014 Management Studio azurebackups5

Once we have the secret key, we can go to SSMS and right click on “Credential” under “Logins” to choose “New Credential”.

SQL SERVER - Backup to Azure Blob using SQL Server 2014 Management Studio azurebackups6

Once this is done, we are all set. Go back to UI and choose “backup-cred” in the drop down. Here is the final screen.

SQL SERVER - Backup to Azure Blob using SQL Server 2014 Management Studio azurebackups7

Once the backup is complete, we should see the backup on the portal. Notice URL

SQL SERVER - Backup to Azure Blob using SQL Server 2014 Management Studio azurebackups8

Once the backup is available, we can also restore it. We can use management studio as well as T-SQL to restore the backup taken on the URL. While choosing the device, we need to use “URL” option, browse to storage container and choose correct file.

SQL SERVER - Backup to Azure Blob using SQL Server 2014 Management Studio azurebackups9

Go ahead and play with this feature.Let me know what you think of the same.

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL Azure, SQL Backup and Restore
Previous Post
SQL SERVER – SQL Server Data Compare Tool
Next Post
SQL SERVER – In-Memory Databases and Caching Wars

Related Posts

Leave a Reply