Blob Storage

Azure Blob storage is a service for storing large amounts of unstructured object data, such as text or binary data, that can be accessed from anywhere in the world via HTTP or HTTPS. We can use Blob storage to expose data publicly to the world, or to store application data privately using SAS (Shared Access Signature).

Some of the practical uses of Blob storage are mentioned below:

  • Serving images or documents directly to a browser
  • Storing files for distributed access
  • Storing data for backup and restore, disaster recovery, and archiving

The Blob service contains the following components:


  • Storage Account: All access to Azure Storage is done through a storage account.
  • Container: A container provides a grouping of a set of blobs. All blobs must be in a container. An account can contain an unlimited number of containers. A container can store an unlimited number of blobs. Note that the container name must be lowercase.
  • Blob: A file of any type and size. Azure Storage offers three types of blobs:              Block blobs, Page blobs, and Append blobs.

    Block blobs are ideal for storing text or binary files, such as documents and media files.

    Append blobs are similar to block blobs in that they are made up of blocks, but they are optimized for append operations, so they are useful for logging scenarios. A single block blob or append blob can contain up to 50,000 blocks of up to 4 MB each, for a total size of slightly more than 195 GB (4 MB X 50,000).

    Page blobs can be up to 1 TB in size, and are more efficient for frequent read/write operations. Azure Virtual Machines use page blobs as OS and data disks.


    How do we do it?

After creating the Storage Access as mentioned in my previous article; you can open visual studio with a new Project.


Add the Nuget Package for Windows Azure Storage


With this package the following Class reference will be added to your project.


Then add Nuget for Windows Azure Configuration Manager, for reading storage connection string from app.config


Now add Storage connection string in the App.Config file. To get the Stirage connection string Open Portal and find the Storage Account you have created eg: ‘abrahamstorageaccount‘ and get the keys for it.


Add the storage account name and keys in the Config as showed below:


In the Visual Studio Project Add a class named ‘BlobStorageExample’


After creating the constructor and initialize the Storage Account, next create a method for creating a container named ‘abrahamcontainer‘.


Rules for creating Container Names

  • Container names must start with a letter or number, and can contain only letters, numbers, and the dash (-) character.
  • All letters in a container name must be lowercase.
  • Container names must be from 3 through 63 characters long

Next create a method for UploadBlob, as mentioned below:


This will upload the video file named ‘wildlife.wmv’ to the Blob named ‘abrahamblob’


Now you can build and Run the solution. After that you can check the uploaded file using Azure Storage Explorer.


Install Azure Storage Explorer and open it.Now provide Storage account credentials to connect to blob.


Once you have connected you can see the video file you have uploaded to blob.10.png

Delete a Blob


Now check using Azure Storage Explorer for the video file, you can see it has been deleted.


I hope now you are able to upload, delete a file to Windows Azure Storage and can access from everywhere.

Happy programming.


%d bloggers like this: