Q73. How to access Azure Table storage from a .NET application?

Applications use a Storage Client Library or REST API to access Azure Table Storage. In fact, the storage client library uses the REST API under the hood. It is an API framework to work with Azure tables, blobs and queues. The latest Version is 4.0 and also gives a better performance.

Storage Client Library is included in the Windows Azure SDK or you can also get it through NuGet package.

Working with REST API is complex where as Working with the Storage Client Library is easy because the library provides methods and classes and it encapsulate the difficulty of using REST methods. To work with Storage Client Library, applications need to reference the Storage Client Library.

Use NuGet to get the reference for storage client library. In Visual studio, Select tools - Library Package Manager - Manage Nuget packages for solution. In NuGet Package Manager, type WindowsAzure.Storage to search. Select Windows Azure Storage and click on the Update button.

manage NuGet package dialog

Ensure that you reference the Microsoft.WindowsAzure.Storage.dll assembly.

If your application uses Windows Azure Tables you should include the following namespaces in your code.

using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Table;
If your application uses Windows Azure Blobs you should include the following namespaces in your code.

using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.blob;
The SDK is available not only for .Net, there are separate SDKs available for different languages such as Node.js, PHP, Ruby, Python and java. In one of the previous Questions and answers, we have already discussed about storage account. Recall that Applications need to provide Storage account details to gain access to services in azure storage.

So, to access the Table storage service, applications need to provide storage account details - name and key.

The next question is how to provide storage account credentials to the application.