iOS - Create Container on a Blob Storage problem


  • Hi,

    I'm adding a storage system on an iOS app that is already available on the app store. I'm following the examples of the docs When I create a container the function createContainer{} with the sharedKey method works fine, but it doesn't work when I'm using the SAS method.

    I'm programming in Objective c and this is the code with my SAS generated with the Microsoft Azure Storage Explorer software (the same with the Portal method),

        NSError *accountCreationError;
        // Create a storage account object from a connection string.
        AZSCloudStorageAccount *account = [AZSCloudStorageAccount accountFromConnectionString:@"SharedAccessSignature=sv=2015-12-11&ss=bfqt&srt=sco&sp=rwdlacup&st=2017-01-03T19%3A49%3A00Z&se=2017-01-04T19%3A49%3A00Z&sig=gzOUJHTPYACS5NwYlk01oWdRSfimvsHgN%2BrBu%2FVEzac%3D;BlobEndpoint=;FileEndpoint=;QueueEndpoint=;TableEndpoint=" error:&accountCreationError];
            NSLog(@"Error in creating account.");
        // Create a blob service client object.
        AZSCloudBlobClient *blobClient = [account getBlobClient];
        // Create a local container object.
        AZSCloudBlobContainer *blobContainer = [blobClient containerReferenceFromName:@"newcontainer2"];
        // Create container in your Storage account if the container doesn't already exist
        [blobContainer createContainerIfNotExistsWithCompletionHandler:^(NSError *error, BOOL exists) {
            if (error){
                NSLog(@"\nError in creating container.");
                NSLog(@"\nContainer OK.");

    And this is the error obtained,

    Error Domain=com.Microsoft.AzureStorage.ErrorDomain Code=3 "(null)" UserInfo={RequestResult=<AZSRequestResult: 0x166cce80>, URLResponse=<NSHTTPURLResponse: 0x165c2ad0> { URL: } { status code: 400, headers {

        Date = "Wed, 04 Jan 2017 10:29:04 GMT";

        Server = "Microsoft-HTTPAPI/2.0";

        "Transfer-Encoding" = chunked;

        "x-ms-request-id" = "8777fca1-0001-00cf-2475-6672b5000000";

    } }, HTTP Status Code=400, OperationContext=<AZSOperationContext: 0x165b9dd0>}

    Any help will be appreciated,

    Thanks in advance,



    Wednesday, January 4, 2017 10:40 AM

All replies