Azure Storage - 28: Azure Blob Service - Metadata


In the previous post I have showed how to work with append blobs. In this post I am going to cover properties and metadata of blobs, containers and Azure Blob service.


Refer to previous posts to get started with Azure Blob Service.


Lets start with properties of CloudBlobClient. Consider the following example:

var blobClient = storageAccount.CreateCloudBlobClient();
blobClient.DefaultRequestOptions.LocationMode = LocationMode.SecondaryOnly;
var stats = blobClient.GetServiceStats();

This code prints service stats for the secondary location. It is possible to get such properties as CORS rules using GetServiceProperties method.

Containers have properties and metadata that can be useful in certain situations:

var container = blobClient.GetContainerReference("testcontainer");

This code outputs ETag and LastModified properties.

Blobs have more properties, but I have already covered most important properties such as BlobType.

Both containers and blobs have metadata. The metadata is stored in the Metadata dictionary. Consider the following example:

container.Metadata.Add("key1", "value1");

It loads metadata from server and then adds a single key to it. It is very simple to manage the container metadata. There are many use-cases where container-level storage can be used.


In this post I have described properties and metadata of Azure Blob Service. In the next post I am going to show how to integrate Azure Content Delivery Network (CDN) with Azure Blob Service.