Interact with the Azure Storage APIs


Azure Storage provides a REST API to work with the containers and data stored in each account. There are independent APIs available to work with each type of data you can store. Recall that we have four specific data types:

  • Blobs for unstructured data such as binary and text files.
  • Queues for persistent messaging.
  • Tables for structured storage of key/values.
  • Files for traditional SMB file shares.

Use the REST API

The Storage REST APIs are accessible from anywhere on the Internet, by any app that can send an HTTP/HTTPS request and receive an HTTP/HTTPS response.

For example, if you wanted to list all the blobs in a container, you would send something like:

GET https://[url-for-service-account]/?comp=list&include=metadata

This would return an XML block with data specific to the account:

<?xml version="1.0" encoding="utf-8"?>  
<EnumerationResults AccountName="https://[url-for-service-account]/">  
        <Last-Modified>Sun, 24 Sep 2018 18:09:03 GMT</Last-Modified>  
        <Last-Modified>Sun, 24 Sep 2018 17:26:40 GMT</Last-Modified>  
        <Last-Modified>Sun, 24 Sep 2018 17:26:40 GMT</Last-Modified>  

However, this approach requires a lot of manual parsing and the creation of HTTP packets to work with each API. For this reason, Azure provides pre-built client libraries that make working with the service easier for common languages and frameworks.

Use a client library

Client libraries can save a significant amount of work for app developers because the API is tested and it often provides nicer wrappers around the data models sent and received by the REST API.

Microsoft has Azure client libraries that support a number of languages and frameworks, including:

  • .NET
  • Java
  • Python
  • Node.js
  • Go

Sample logos of supported frameworks you can use with Azure

For example, to retrieve the same list of blobs in C#, we could use the following code snippet:

string containerName = "...";
BlobContainerClient container = new BlobContainerClient(connectionString, containerName);

var blobs = container.GetBlobs();
foreach (var blob in blobs)
    Console.WriteLine($"{blob.Name} --> Created On: {blob.Properties.CreatedOn:YYYY-MM-dd HH:mm:ss}  Size: {blob.Properties.ContentLength}");

Or in JavaScript:

const containerName = '...';
const containerClient = blobServiceClient.getContainerClient(containerName);

let blobs = containerClient.listBlobsFlat();
for await (const blob of blobs) {
  console.log(`${} --> Created: ${}   Size: ${}`);


The client libraries are just thin wrappers over the REST API. They are doing exactly what you would do if you used the web services directly. These libraries are also open source, making them very transparent. For links to the source code for these libraries on GitHub, at the end of this module, see the Additional Resources section.

Let's add client library support to your app.