Configure work with Azure Blob Storage in your solution

Windows Azure Blob storage is a service for storing large amounts of unstructured data that can be accessed from anywhere in the world via HTTP or HTTPS. A single blob can be hundreds of gigabytes in size, and a single storage account can contain up to 100TB of blobs. Common uses of Blob storage include:


  •    Serving images or documents directly to a browser
  •    Storing files for distributed access
  •    Streaming video and audio
  •    Performing secure backup and disaster recovery
  •    Storing data for analysis by an on-premises or Windows Azure-hosted service


Windows Azure Blob has next hierarchy:

Azure Blob hierarchy

Blob hierarchy


Store logs into Azure Blob Storage

In this article I will show you how to write logs in Blob table. As log manager in the system I will use Log4net because Blob gives us a great possibility to work with this Log4net. 

Log4Net is a popular logging framework, and if you have an existing application that you wish to move to Azure computer, you probably want to avoid rewriting your application to use another logging framework. Luckily, keeping Log4Net as your logging tool in Azure is certainly possible, but there are a few hoops you have to jump through to get there. So we will write our logs from project to some blob table. For this purpose we can use our project from the previous topic that already have a connection to Azure and to Blob Storage account. So let's start.


In very first step we need to add the Log4net library to our project. We can use NuGet for this purpose. So we should open our MvcApplicationWebRole project and right click on folder References and select “Manage NuGet Packages”. NuGet will occur.  Enter “log4net” in the search window. And press install when it find this library:

Add Log4net library to project - Manage NuGet Packages

Add Log4net library to project