Azure Storage libraries for Java

The Azure Storage libraries for Java provide classes for working with data in your your Azure storage account, and with the storage account itself. For more information about Azure Storage, see Introduction to Azure Storage.

Client library for data access

Use the Azure Storage client library for Java to work with data in your storage account:

Create, update, and manage Azure storage accounts from your Java application with the management modules.

Add the package to your project

Add the following dependencies to your Maven pom.xml file as appropriate:



For more information about adding a dependency in Java, see Add a dependency.

Example usage

The following example creates a storage container and uploads a local file to the storage container.

String yourSasToken = "<insert-your-sas-token>";
/* Create a new BlobServiceClient with a SAS Token */
BlobServiceClient blobServiceClient = new BlobServiceClientBuilder()

/* Create a new container client */
try {
    containerClient = blobServiceClient.createBlobContainer("my-container-name");
} catch (BlobStorageException ex) {
    // The container may already exist, so don't throw an error
    if (!ex.getErrorCode().equals(BlobErrorCode.CONTAINER_ALREADY_EXISTS)) {
        throw ex;

/* Upload the file to the container */
BlobClient blobClient = containerClient.getBlobClient("my-remote-file.jpg");

For more examples, review the Client Library README.

Available packages

The following table describes the recommended versions of the storage client library for Java.

Library version Supported services Maven Reference / Javadoc Source, Readme, Examples
Version 12 Blob and Queue Blob
Blob (Quickstart)
Version 8 Blob, Queue, File, and Table All services Version 8 reference All services (Quickstart)

Accessing other storage account services with v12 libraries

Currently, the following libraries are in public preview:

  • File shares
  • Data Lake

Refer to the Azure SDK Releases page for details on how to to install and use the preview packages.

Client library for resource management

Use the Azure Storage resource provider to manage storage accounts, account keys, access tiers, and more. To use the resource provider library, add a dependency to your Maven pom.xml file. The latest version of the resource provider library is available on Maven.

For more information about the resource provider library, see the Management reference. The source code for the resource provider library is available in the Azure Java SDK repository.

The following example creates a new storage account in your subscription and retrieves its access keys.

StorageAccount storageAccount = azure.storageAccounts().define(storageAccountName)

// get a list of storage account keys related to the account
List<StorageAccountKey> storageAccountKeys = storageAccount.getKeys();
for(StorageAccountKey key : storageAccountKeys)    {
    System.out.println("Key name: " + key.keyName() + " with value "+ key.value());