Code Monkey home page Code Monkey logo

storage-blob-cpp-getting-started's Introduction

services platforms author
storage
cpp
pcibraro

Azure Storage Service Samples in C++

Demonstrates how to use the Blob Service.

  • Azure Blob storage is a service that stores unstructured data in the cloud as objects/blobs. Blob storage can store any type of text or binary data, such as documents, media files or application installers. Blob storage is also refered to as object storage. This sample demostrates how to perform common tasks for managing containers and blobs with data.

Note: This sample uses the Windows Azure Storage client library for C++ available through a Nuget package, which depends on the Visual Studio version you will use for development. For Visual Studio 2015, use the Nuget package "wastorage.v140". For Visual Studio 2013, use "wastorage.v120".

If you don't have a Microsoft Azure subscription you can get a FREE trial account here.

Running this sample in Windows

This sample can be run using either the Azure Storage Emulator that installs as part of the Windows Azure SDK - or by updating the storage_connection_string variable defined at the top of the program.

To run the sample using the Storage Emulator (Windows Azure SDK):

  1. Download and Install the Azure Storage Emulator here.
  2. Start the Azure Storage Emulator (once only) by pressing the Start button or the Windows key and searching for it by typing "Azure Storage Emulator". Select it from the list of applications to start it.
  3. Set breakpoints and run the project using F10.

To run the sample using the Storage Service

  1. Open the storage-getting-started.cpp file and find the variable storage_connection_string. Replace the value (UseDevelopmentStorage=True) with the connection string for the storage service (AccountName=[]...)
  2. Create a Storage Account through the Azure Portal and provide your [AccountName] and [AccountKey] in the storage_connection_string variable.
  3. Set breakpoints and run the project using F10.

Running this sample in Linux

In order to compile and run this sample in Linux, you first need to get a local copy of the C++ REST SDK (aka Casablanca) from [here] (https://github.com/Microsoft/cpprestsdk) and the Azure Storage Client Library for C++ from [here] (https://github.com/Azure/azure-storage-cpp). Both libraries must be compiled following the instructions described in the corresponding Github repositories. Once you have these libraries, follow these instructions to build the samples,

  • Clone the project using git:
git clone https://github.com/Azure-Samples/storage-blob-cpp-getting-started.git

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

  • Build the samples:
cd storage-blob-cpp-getting-started/storage-blob-cpp-getting-started
mkdir build
cd build
CASABLANCA_DIR=<path to Casablanca> AZURESTORAGE_DIR=<path to AzureStorage> 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 and <path to Casablanca> to point to your local installation of the Azure Storage Client library. For example, if the file libcpprest.so exists at location ~/Github/Casablanca/cpprestsdk/Release/build.release/Binaries/libcpprest.so and the file libazurestorage.so exists at location ~/Github/azure-storage-cpp/Microsoft.WindowsAzure.Storage/build.release/Binaries/libazurestorage.so, then your cmake command should be:

CASABLANCA_DIR=~/Github/Casablanca/cpprestsdk AZURESTORAGE_DIR=~/Github/azure-storage-cpp CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release

The sample is generated under storage-blob-cpp-getting-started/storage-blob-cpp-getting-started/build/Binaries/.

More information

storage-blob-cpp-getting-started's People

Contributors

acomsmpbot avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

storage-blob-cpp-getting-started's Issues

Accessing metadata

Pablo - thanks for the excellent examples.
Could you tell me how to read and list the metadata key/value pairs?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.