Reputation: 150
I followed the azure tutorial in order to upload photos in an azure account storage : https://azure.microsoft.com/en-us/documentation/articles/storage-python-how-to-use-blob-storage/
This is my code (exactly the same than the tutorial) :
from azure.storage.blob import BlockBlobService
from azure.storage.blob import PublicAccess
class UserPhotoBlobStorage():
ACCOUNT_NAME = "account_name"
ACCOUNT_KEY = "account_key"
def __init__(self):
self.block_blob_service = BlockBlobService(account_name=UserPhotoBlobStorage.ACCOUNT_NAME,
account_key=UserPhotoBlobStorage.ACCOUNT_KEY)
self.block_blob_service.create_container('mycontainer', public_access=PublicAccess.Container)
if __name__ == '__main__':
storage = UserPhotoBlobStorage()
But when I execute it I have this following exception :
Can somebody explain me what is the problem ? I contacted the azure support which told me that they couldn't do anything for me ...
In addition, I'm using the recommended python package in the tutorial : https://github.com/Azure/azure-storage-python with the latest version.
Upvotes: 0
Views: 1382
Reputation: 71119
The error is related to your account key being incorrect. The Azure storage key is base64-encoded. The string you provided ("account_key"
) is not properly base64-encoded, hence the Incorrect padding
error. Try running this again with the full account key (either primary or secondary) provided within the portal.
Upvotes: 1