Windows Azure Backups with Bacpac–Automating Exports (Part 2)

This is part 2 of my azure backups “series”.  This will go into doing exports of an Azure database to Bacpac file in blob storage.  Part one just went over a couple of options for backups and how to do it manually.

Today we’ll be looking at the simple case for exporting your databases.  By simple I mean you just have your database and no DataSync enabled on the database.  If you are in the situation where you are using DataSync, I’ve got a solution, it’s ugly but it works (you’ll have to wait for part 4).

The basic idea is that we’re going to use the API to command Azure to export the database to a storage container.

I based my code on the following blog by Colin Farr:

It’s a great article and goes over how to do it.  Honestly, my code doesn’t change a whole lot, so a lot of the credit goes to Colin on his excellent example.  I do give the option of doing selective export but that’s very minor.

This is only the function for performing the backup, I have rolled it into a whole class to be used with some clean up.

You basically pass in the name of the database, (optionally) a list of tables you’d like to export and it’ll give you back a status id and a filename that it saved the backup to.  All of the credentials are setup through the constructor (not shown), but you could easily hard code that into the function if you wanted.

That’s it for now.

Azure Backups Series:


3 thoughts on “Windows Azure Backups with Bacpac–Automating Exports (Part 2)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s