Thursday, January 27, 2011

A Trip Thru Azure (part1)

As a member of BizSpark, I get an Azure account to play with, so I have been trying to figure out what to do with it. So I now have a couple apps in mind for Azure and have begun playing with my account. I started to play with Azure storage and storing blobs.

I have the need for some storage for audio files for a website that I have hosted for years. After cleaning up a test file it ended up being about a 56M mp3 file. This would be a good test for Azure Storage and blobs.

Looking at the code for Azure, it seemed that I needed to use the API to code the saving of the files. I figured that someone wrote an app for it already and found one named Blobber. In the config file for the app, you had to put in the AccountName, SharedKey, and ContainerName for where you want things stored. So after getting the AccountName and the SharedKey that I setup in the Azure account site. I was not sure what the ContainerName was. The blob storage does not use folders, but uses the ContainerName as a virtual folder to help sort your data. So I created the ContainerName of audio. Running the app, it took a long time to upload the 56M file.

Then I started to test the downloading of the file. I created the url that it should have been put it in a browser and.... nothing. It did not work. I tried one thing after another and came up with nothing.

I then found a great little application called CloudBerry Explorer for Azure Blob Storage. This allows you to access your cloud storage just like you would in explorer. You can add/remove files and containers. With a right click, it allows you to get a url to the blob. It also had options to have a time limit for the url using parameters. I got a url with a timelimit until the end of the month. Put that into my browser and it worked great.

I was very happy to finally have some success, so I emailed the link to others and went to bed. The next morning I get a reply saying that the link does not work. I did some more research and found out that the link with time limits only lasted one hour. After a couple more emails saying that it did not work, I tried to figure out why. I ended up emailing a friend that works at Microsoft and does alot of talks on Azure, Jim O'Neil. He had the answer for me quickly. Containers get created as private to start. Jim suggested to change the container to public. Once I did this, the url worked great.

Ok, this first step into the world of Azure was a success with abit of help. I can store large files and serve them up with a url to let others get at them. The next step for me is to get Azure SQL setup to support a couple of phone apps that I am building.