When using SQL Databases in Microsoft Azure you´re self responsible for backups. Of course, usually the SQl Azure database cluster takes care of availability – but what if an app deletes records, or you need an older consistent version of a database or you want to work with the data on your local system or in your company´s network?
This article shows how to create manual and automated backups and restore them locally or in the cloud.
For these purposes you can use the (still in preview) Azure database backup function. Decide, when you want to backup your database - it´s simple, see ScottGu´s blogpost.
First create an online BLOB storage for your backup files. I usually name them [subscriptionname]databasebackup, like “t3databasebackup”.
To avoid additional costs, take care that the storage is in the same region as your database server!
In my sample that´s “Nort Europe”.
Now change to databases and select the database you want to backup, here “D365Creator”.
You can check the database size anytime in the Dashboard:
That´s easy. Click the “Export” button at the bottom. Choose your storage and a container (f.e. I created a container “databasebackup”), fill in the SQL admin account and password and go.
Depending on the size you get the result in the storage where you can download the backup file with the “.bacpac” extension.
Click “Configure” for creating a backup. Simply fill out the form. The time is UTC, so add or subtract your time zone according to UTC time.
For time and cost info, pls. check ScottGu´s article.
I like the “Always keep at least one export file.” switch to ensure that there´s at least on backup, even if the time span is greater than f.e. 30 days.
That´s it, from now on the backup happens at the specified time into your storage!
Local Restore in SQL Server
After downloading the .bacpac file you can restore it in your SQL Server. Right click the “Database” node to open the context menu and select “Import Data-tier Application…”. Go thru the wizard, and select your .bacpac file.
The second step asks for the file. As you see here, instead of downloading you can also directly connect to the Azure storage if you have your storage account and the key information.
Very simple, or?
Restore in SQL Azure
Use the same mechanism for restoring the .bacpac file in the Azure portal, for example for duplicating a database or to create a hot and cold database. In the database section click “Add New”.
And choose SQL Database/Import. Now select the .bacpac file and the details of your desired SQL Server.
I really like the easy to use SQL backup and restore mechanisms of SQL Azure!
Hope you find this article useful for your SQL Azure management backup and restore tasks!