Nhlakanipho Sanele
Nhlakanipho Sanele

Reputation: 9

Azure storage Services

How do you create a blob or tables in using Azure storage services?. I have created the Azure storage account. below is the code I have written using c#.

    private CloudBlobContainer GetCloudBlobContainer()
    {
       // this is the storage account connection string created

        CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
                CloudConfigurationManager.GetSetting("<storageaccountname>_AzureStorageConnectionString"));
        CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
        CloudBlobContainer container = blobClient.GetContainerReference("test-blob-container");
        return container;

I have created the storage account and now the connection string, so how do I proceed from here?

Upvotes: 1

Views: 72

Answers (1)

Martin Brandl
Martin Brandl

Reputation: 58931

All you have to do is to call the CreateIfNotExist() method on the container to create it:

container.CreateIfNotExist();

Upvotes: 3

Related Questions