Introduction To Windows Azure Blob Storage
Introduction To Windows Azure Blob Storage
Introduction To Windows Azure Blob Storage
www.globallogic.com
An Introduction to Windows Azure Blob Storage Tanveer Ahmed Siddiqui, Senior Consultant Engineer
Introduction
The term “blob” is commonly understood to mean If you go by Microsoft’s definition, “Windows Azure
“Binary Large OBject.” Many of us are familiar with this Blob storage is a service for storing large amounts of
term from its usage in a database, where “blob data” unstructured data that can be accessed from anywhere
might be data stored in our database that does not in the world via HTTP or HTTPS.”
conform to an established data type as defined by the
database. Such data is usually persisted as plain binary In the below example, myaccount is the name of the
data. storage account, mycontainer is the container name, and
myblob is your actual blob.
Windows Azure Blob storage offers a way to store
content and make it available across the web. It’s like https://myaccount.blob.core.windows.net/mycontainer/
a storage drive on the cloud that is used to store large myblob
amounts of data. You can store files and folders of any
format and type – just like the drive on your computer – A blob’s size can be hundreds of GBs, and a storage
and share it across the web. account can contain up to 200TB of blobs.
FAQ.txt
TnC.txt
mycontainer
Folder1
myaccount
media
IMG1.jpg
VE1.mp3
5. Click Storage.
7. In the URL textbox, enter a storage account name to use in the URI. The name should be 3-24 lowercase letters
and numbers. This value becomes the host name within the URI that is used to address blob, queue, or table
resources for the subscription.
8. Under the Location/Affinity Group dropdown menu, select a Region/Affinity Group in which to locate the storage.
If you will be using storage from your Windows Azure application, select the same region where you will deploy
your application.
Code Samples for Blob Operations
Before working with blobs, you first need to configure the storage account connection string in your application.
When using Windows Azure Cloud Services, it is recommended that you store your connection string using the
Windows Azure service configuration system (*.csdef and *.cscfg files).
When using Windows Azure Web Sites, Windows Azure Virtual Machines, or building .NET applications that are
intended to run outside of Windows Azure, it is recommended that you store your connection string using the .NET
configuration system (e.g. web.config or app.config file).
Now you need to add assembly reference of Microsoft.WindowsAzure.Storage.dll in your project reference.
You can use NuGet to obtain the Microsoft.WindowsAzure.Storage.dll assembly. Right-click your project in Solution
Explorer and choose Manage NuGet Packages. Search online for “WindowsAzure.Storage” and click Install to install
the Windows Azure Storage package and dependencies.
Namespace Declaration
Add the following namespace declarations to the top of any C# file in which you wish to programmatically access
Windows Azure Storage.
If you are using Windows Azure Web Sites, Windows Azure Virtual Machines, or building .NET applications that are
intended to run outside of Windows Azure, and your connection string is located in the web.config or app.config
(as show above), then you can use ConfigurationManager to retrieve the connection string. You will need to add a
reference to System.Configuration.dll to your project, and add another namespace declaration for it.
A CloudBlobClient type allows you to retrieve objects that represent containers and blobs stored within the Blob
Storage Service. The below diagrams contain code snippets for the following functions.
Create Container
LIST Container
Delete Container
List Blob
Get Blob
Copy Blob
Delete Blob