Azure Blob Storage handling using c#

Window azure blob storage is a service providing by Microsoft to store a large amount of unstructured data into the cloud that can be accessed from anywhere via HTTP or HTTPS. A single blob can be more than 100 GB in size and one blob account container can have more than 100 TB in size.

Common uses of the blob storage are –
  • Serving images or files directly to a browser
  • Get distributed access of the data
  • Streaming Video/Audio file
  • Perform secure backup 
On a recent application, we implemented image uploading and downloading by using blob storage.As per the requirement When user logs in to the application then he should be able to see his profile picture and also he should be able upload the new picture for his profile.

We will go through each operation step by step and cover the following topics-

  1. Downloading of an image from Azure Blob Storage
  2. Uploading of an image to Azure
We implemented the above both operations by using Jquery with WCF service by an Ajax call.
For doing the above both operation we need to have few values as mentioned below –
  • Storage account – This we can get while initially set-up the storage account in blob. Let’s say tStorageAccount (just a variable name for the reference).
  • Container name – This is a container which is created in blob for storing of files. Let’s say tBlob (just a variable name for the reference).
  • Account key – Available in blob storage account. There is a clickable item ‘Manage Keys’. Click on it, a dialog box will appear with account key. This is just a long string of random characters.
  • Connection string – A valid connection string is required. This contains-
    • Protocol (DefaultEndpointsProtocol=https)
    • Account name (AccountName=_AccountName)
    • Account key (AccountKey=qJWc2hzcTKTVau3G7SWFAw+vW0quoldFsFPA++QM5z8jooV1l1H9T)
Once we will have all the things mentioned above, we should go further.
  1. Downloading of an image from Azure Blob Storage
  2. Uploading an image to Azure Blob Storage
Please click on any of the above link to get the detail.

Post a Comment

0 Comments