20 September 2011

SQL Azure, the bacpac & Storage Containers

Silly me. I thought it would be easy. I grab a copy of the latest SQL Azure Backup and I show how to use the new import/export routine in SQL Azure. Ha!

NOTE: These difficulties are all on the Microsoft side of things. Our nifty little tool, SQL Azure Backup, works great. after you get things configured correctly in Azure. Read through to the bottom for the “rest of the story.”

You have to have a Storage Account

Cool. That’s easy. Log into the Windows Azure Platform Manager. On the home page you can find out exactly how to do set up a storage account.

image_thumb.png

And it’s silly simple. You navigate to the “Hosted Services, Storage Accounts & CDN” and there’s a listing of various services that you’ve set up. I found you can right click the “Storage Accounts” in the explorer part of the window and select new. Easier still, sitting right on top of the Platform Manager is a bunch of buttons. The first set is exactly what you need:

image_thumb_3.png

You click on the “New Storage Account” button and you get taken to the “Create a New Storage Account” window. Simple stuff. You define your subscription, mine is the ScaryDBA. Then you define a URL, a lower case name, that’s going to be where the blobs get stored (maybe, more on that in a minute) and you  pick an affinity group. The choices there are varied depending on where you are on the planet, etc.  I didn’t much care since I’m mainly playing, so I was fine with anywhere in the US.

image_thumb_4.png

You click OK and it takes a little while but you end up with a Storage Account. So far, so simple. The storage account has Access Keys that you’ll need to use to set up your bacpac import/export. Again, quick & simple to access. Right click on your new storage account and there’s a context menu to get your keys:

image_thumb_5.png

Done.

Now, the next thing you have to have to get the bacpac going in SQL Backup is the container. Basically just a folder where the blobs are going to be stored. I’m in the Platform Manager and I’m looking. There’s no nifty little button. There’s no context menu. I can’t see any mechanism for creating a container. Time hit the books.

F What? F#? F Something!

Upon hitting the documentation I quickly realize I’m slightly over my head. Remember, I’ve been a database developer/DBA/Data Architect for the last 10 years. Yeah, I used to do a lot of C# coding & some Java and VB.NET & VB, but that was a while ago. Now I’m suddenly looking at F# code. I didn’t even realize that C# was old. When did D# & E# come out?

This part was not so easy.

First, I found I didn’t have Visual Studio even installed. Got that done. Started up a C# Cloud project and then found I needed multiple DLL’s downloaded there. Yay! Got that done. Just the installs were taking all sorts of time. Finally, it was all done. I had to search around to find a suitable bit of code to perform the action and found a good example here at this link.

Now I can finally run a backup using the Azure Import/Export option with SQL Azure Backup. oh, just got an email from the developer. He’s updated SQL Azure Backup. what’s that? It’ll create a container for you because that’s a pain for most people? I’m posting this blog post anyway.

Keep up to date with Simple-Talk

For more articles like this delivered fortnightly, sign up to the Simple-Talk newsletter

This post has been viewed 2267 times – thanks for reading.

  • Rate
    [Total: 0    Average: 0/5]
  • Share

Grant Fritchey is a SQL Server MVP with over 20 years’ experience in IT including time spent in support and development. Grant has worked with SQL Server since version 6.0 back in 1995. He has developed in VB, VB.Net, C# and Java. Grant has authored books for Apress and Simple-Talk, and joined Red Gate as a Product Evangelist in January 2011. Find Grant on Twitter @GFritchey or on his blog.

View all articles by Grant Fritchey