Microsoft Azure Storage Client Library for C++  5.2.0
The Microsoft Azure Storage Client Library for C++ is a library for working with the Azure Storage Services in C++.
Azure Storage Client Library for C++ (5.2.0)

The Azure Storage Client Library for C++ allows you to build applications against Microsoft Azure Storage. For an overview of Azure Storage, see Introduction to Microsoft Azure Storage.

There is an alternative client library that requires minimum dependency, which provides basic object storage that Blob service offers. Please see azure-storage-cpplite for more information.

Features

Getting started

For the best development experience, we recommend that developers use the Vcpkg as the cross-platform library manager.

Requirements

To call Azure services, you must first have an Azure subscription. Sign up for a free trial or use your MSDN subscriber benefits.

Need Help?

Be sure to check out the Azure Storage Forum on MSDN if you need help, or use StackOverflow.

Collaborate & Contribute

We gladly accept community contributions.

For general suggestions about Azure, use our Azure feedback forum.

Download & Install

Via Git

To create a local clone of the source for the Azure Storage Client Library for C++ via git, type:

git clone https://github.com/Azure/azure-storage-cpp.git
cd azure-storage-cpp

Via NuGet

To install the binaries for the Azure Storage Client Library for C++, you can export a NuGet package with Vcpkg and put it into your local NuGet feed. For more information about how to export a NuGet package, please see https://github.com/Microsoft/vcpkg/blob/master/docs/specifications/export-command.md "Binary Export".

Normally, exporting NuGet package is done with the following command:

C:\src\vcpkg> .\vcpkg export --nuget azure-storage-cpp --nuget-id=Microsoft.Azure.Storage.CPP --nuget-version=5.1.0

Via Vcpkg

To install the Azure Storage Client Library for C++ through Vcpkg, you need Vcpkg installed first. Please follow the instructions(https://github.com/Microsoft/vcpkg#quick-start) to install Vcpkg.

install package with:

C:\src\vcpkg> .\vcpkg install azure-storage-cpp

Visual Studio Version

Starting from version 2.1.0, Azure Storage Client Library for C++ supports Visual Studio 2013 and Visual Studio 2015. In case you have the need to use Visual Studio 2012, please get version 2.0.0.

Dependencies

C++ REST SDK

The Azure Storage Client Library for C++ depends on the C++ REST SDK (codename "Casablanca") It can be installed through Vcpkg (vcpkg install cpprestsdk) or downloaded directly from GitHub.

The validated Casablanca version for each major or recent release on different platforms can be found in the following chart:

azure-storage-cpp's version Casablanca version for Windows Casablanca version for Linux
1.0.0 2.4.0 2.4.0
2.0.0 2.4.0 2.4.0
3.0.0 2.9.1 2.9.1
4.0.0 2.9.1 2.9.1
5.0.0 2.9.1 2.9.1
5.0.1 2.9.1 2.9.1
5.1.0 2.10.6 2.10.3
5.1.1 2.10.6 2.10.3
5.2.0 2.10.6 2.10.3

Code Samples

To get started with the coding, please visit the following articles:

To accomplish specific tasks, please find the code samples at samples folder.

Getting Started on Linux

Getting Started on Ubuntu

As mentioned above, the Azure Storage Client Library for C++ depends on Casablanca. Follow these instructions to compile it.

Once this is complete, then:

To build and run unit tests:

To build sample code:

CASABLANCA_DIR=<path to Casablanca> CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON
make

To run the samples:

cd Binaries
vi ../../samples/SamplesCommon/samples_common.h # modify connection string to include your storage account credentials
./samplesblobs # run the blobs sample
./samplesjson # run the tables sample with JSON payload
./samplestables # run the tables sample
./samplesqueues # run the queues sample

Please note the current build script is only tested on Ubuntu 16.04. Please update the script accordingly for other distributions.

Please note that starting from 2.10.0, Casablanca requires a minimum version of CMake v3.1, so the default CMake on Ubuntu 14.04 cannot support Casablanca build. User can upgrade CMake by themselves to build Casablanca. If default CMake (2.8) for Ubuntu 14.04 must be used, 5.0.1 with Casablanca version v2.9.1 is recommended.

Getting Started on SLES12

Please note the folloing build script is only tested on SLES12 SP3. The script may need to be updated accordingly for other distributions.

Before building the Azure Storage Client Library on C++, some prerequisites need to be installed first:

The Azure Storage Client Library for C++ depends on Casablanca, following are instructions to build and install Casablanca:

To build the Azure Storage Client Library for C++ project:

The library is generated under azure-storage-cpp/Microsoft.WindowsAzure.Storage/build.release/Binaries/.

The Azure Storage Client Library for C++ project depends on Unitest++ for unit test:

To build and install Unitest++:

Build and run unit test against Azure Storage Client Library for C++:

To build sample code:

CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON
make

To run the samples:

cd Binaries
vi ../../samples/SamplesCommon/samples_common.h # modify connection string to include your storage account credentials
./samplesblobs # run the blobs sample
./samplesjson # run the tables sample with JSON payload
./samplestables # run the tables sample
./samplesqueues # run the queues sample

Getting Started on OSX

Note that OSX is not officially supported yet, but it has been seen to work, YMMV. This build has been tested to work when the dependencies are installed via homebrew, YMMV if using FINK or MacPorts

Install dependecies with homebrew:

brew install libxml2 ossp-uuid openssl

As mentioned above, the Azure Storage Client Library for C++ depends on Casablanca. If you are using homebrew you can install it from there:

brew install cpprestsdk

Otherwise, you may need to build it. Follow these instructions to compile it.

Once this is complete, then:

Some notes about building:

cd azure-storage-cpp/Microsoft.WindowsAzure.Storage
mkdir build.release
cd build.release
CASABLANCA_DIR=<path to casablanca> cmake .. -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=<path to openssl> -DGETTEXT_LIB_DIR=<path to gettext lib dir>
make

In the above command, replace:

For example you might use:

CASABLANCA_DIR=~/Github/Casablanca/cpprestsdk cmake .. -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DGETTEXT_LIB_DIR=/usr/local/opt/gettext/lib

The library is generated under azure-storage-cpp/Microsoft.WindowsAzure.Storage/build.release/Binaries/.

To build and run unit tests:

Learn More