Using Azure Storage on Linux


We want to provide an update for Linux users on how to use Azure Storage, and we are pleased to announce some new options. Currently, we are testing with Ubuntu 14.04; we will look at feedback to determine which additional distros to include over time.

Java

Our Java library, which we announced the General Availability for earlier this year, has now been fully stress-tested with Linux. You can get the latest Java library through Maven (http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22azure-storage%22) or as source code (https://github.com/Azure/azure-storage-java).

Node.js

We released an updated Node.js library earlier this year, in preview for both Windows and Linux. You can get the node.js library through npm (https://www.npmjs.org/package/azure-storage) or Github (https://github.com/Azure/azure-storage-node).

C++

We are pleased to announce that we have released preview version 0.4.0 of our C++ library, which now compiles for both Windows and Linux. 0.4.0 also contains new features including blob download auto-resume functionality and control over the internal buffer size used in the HTTP layer, so we recommend that everyone using an older version upgrades.

Compiling from source is supported for both Windows and Linux; the source code is available through GitHub (https://github.com/Azure/azure-storage-cpp). Binaries for Windows are also available through NuGet (http://www.nuget.org/packages/wastorage/).

Getting Started on Linux

The Azure Storage Client Library for C++ depends on Casablanca. Follow these instructions to compile it. Version 0.4.0 of the library depends on Casablanca version 2.3.0.

Once this is complete, then:

  • Clone the project using Git:
git clone https://github.com/Azure/azure-storage-cpp.git

The project is cloned to a folder called azure-storage-cpp. Always use the master branch, which contains the latest release.

  • Install additional dependencies:
sudo apt-get install libxml++2.6-dev libxml++2.6-doc uuid-dev
  • Build the SDK for Release:
cd azure-storage-cpp/Microsoft.WindowsAzure.Storage
mkdir build.release
cd build.release
CASABLANCA_DIR=<path to Casablanca> CXX=g++-4.8 cmake .. 
-DCMAKE_BUILD_TYPE=Release
make

In the above command, replace <path to Casablanca> to point to your local installation of Casablanca. For example, if the file libcpprest.so exists at location ~/Github/Casablanca/casablanca/Release/build.release/Binaries/libcpprest.so, then your cmake command should be:

CASABLANCA_DIR=~/Github/Casablanca/casablanca CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release

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

Once you have built the library, the samples should work equally well for Windows and Linux. If you like, you can build the samples as well:

cd ../samples
vi SamplesCommon/samples_common.h – edit this file to include your storage account name and key
mkdir build.release
cd build.release
CASABLANCA_DIR=<path to Casablanca> CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release
Make

To run the samples:

cd Binaries
cp ../../BlobsGettingStarted/DataFile.txt . (this is required to run the blobs sample)
./samplesblobs (run the blobs sample)
./samplestables (run the tables sample)
./samplesqueues (run the queues sample)

The getting-started samples in this blog post are also helpful: http://blogs.msdn.com/b/windowsazurestorage/archive/2013/12/20/windows-azure-storage-client-library-for-cplusplus-preview.aspx

Differences between Windows and Linux Client Libraries

The only major difference is in logging. On Windows, we use ETW logging directly. On Linux, we use Boost logging, which means that you can plug in your own sinks as you see fit. Each operation_context has a boost::log::sources::severity_logger<boost::log::trivial::severity_level>; if you want fine-grained control over logging feel free to set your own logger objects. Note that in addition to what Boost provides, we have an internal log_level that we use. Each operation_context gets a log_level that you can set. The default value is set by client_log_level operation_context::default_log_level, which you can also set to turn logging on or off for the library as a whole. The default is that logging is off entirely.

What’s next

We’re excited about supporting Linux-based usage of Azure Storage from Java, Node.js, and C++. We encourage you to try it out and let us know where we can improve by leaving feedback on GIthub or on this blog. We’ll be working to bring these all to general availability.

Adam Sorrin and Jeff Irwin
Microsoft Azure Storage Team


Comments (0)

Skip to main content