Interact with the Azure Storage APIs


Azure Storage provides a REST API to work with the containers and data stored in each account. Each type of data you can store has its own independent API. 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 create a request something like:

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

This request returns 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 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 has been tested and often provides nicer wrappers around the data models sent and received by the REST API.

Microsoft has Azure client libraries that support many languages and frameworks, including:

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

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 around 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.

Next, let's add client library support to your app.