0
votes

After creating an Azure Storage account using Python SDK when proceeding to create a storage blob container its throws the following error : ResourceNotFoundThe specified resource does not exist. RequestId:508e8df1-301e-004b-224e-c5feb1000000 Time:2018-03-26T22:03:46.0941011Z

Code snippet:

def create_blob_container(self, storage_account_name, storage_account_key, version):
    try:
        account = BlockBlobService(account_name = storage_account_name, account_key = storage_account_key.value)          
        container_name = "dummy container"
        container = account.create_container(container_name)
        if container:
            print 'Container %s created' %(container_name)
        else:
            print 'Container %s exists' %(container_name)
    except Exception as e:
        print e

Does anybody have any idea how to go about this?

P.S.: I am waiting for provisioning state of storage account to be succeeded and then proceeding to create a container.

Any help is greatly appreciated.

2
Do you have any space in your container name ? I don't think space are allowed in container name.Thomas
Container names must be all lowercase, no spaces and no longer than 63 characters. Check if all this is true in your case.trailmax
Also storage account names have similar restrictions and must be between 3 and 24 characters and globally unique. I.e. if somebody already taken "mystorage" - you won't be able to create the same accounttrailmax
container name and storage account names both are valid. @ThomasRahul Goud
which version of the puthon sdk are you using ?Thomas

2 Answers

0
votes

Firstly, as @Thomas and @trailmax mentioned in the comment that the container name and blob name need to follow naming rules. The "dummy container" in your sample code is inconsistent with the rules certainly. It will throw exception :

azure.common.AzureHttpError: The specifed resource name contains invalid characters.ErrorCode: InvalidResourceName

Then I test your code and it works well for me.

from azure.storage.blob import (
    BlockBlobService,
    ContainerPermissions,
)

accountName = "***"
accountKey = "***"
containerName = "test"

account = BlockBlobService(account_name = accountName, account_key = accountKey)
container = account.create_container(containerName)
if container:
    print 'Container %s created' %(containerName)
else:
        print 'Container %s exists' %(containerName)

I suggest you check if your request client has permission to create resources in the storage account. If no permission of creation, above exception will be thrown.

Hope it helps you.

0
votes

Just spoke with Microsoft Azure team, apparently they are facing network related issues with storage accounts. For me, its failing all the time when I try to create a container, but for one of my colleague, he is getting mixed results; sometimes it goes through in 15seconds, sometimes it takes upto 10 minutes and most of the times it is bailing out.

That might be what’s going on- they’ll get back to us tomorrow with an update.