06 August 2015 Azure Robert Muehsig

Sometimes I just want to write blogposts to memorize it better even if the stuff is actually quiet old. So… and now I present you:

How To write a simple text to Azure Storage

All you need is the Microsoft.WindowsAzure.Storage NuGet Package (well… there is also a REST API available, but in the .NET land, this is much easier).

CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["storage"].ConnectionString);

// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

// Retrieve a reference to a container.
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");

// Create the container if it doesn't already exist.

// Make it public - because sharing is good, right?
    new BlobContainerPermissions
        PublicAccess =

CloudBlockBlob blockBlob = container.GetBlockBlobReference("myblob");

var foobar = "helloworld";


Besides “UploadText” there a bunch of other methods available to save a stream or bytes etc..

The “CloudStorageAccount.Parse” needs a well formed WindowsAzure Storage ConnectionString.

That’s all. If you want to learn more: Azure Documentation

Hope this helps!

Written by Robert Muehsig

Software Developer - from Saxony, Germany - working on primedocs.io. Microsoft MVP & Web Geek.
Other Projects: KnowYourStack.com | ExpensiveMeeting | EinKofferVollerReisen.de