无法使用 python 创建 azure 存储容器

Can't create azure storage container with python

我按照 azure 教程在 azure 帐户存储中上传照片:https://azure.microsoft.com/en-us/documentation/articles/storage-python-how-to-use-blob-storage/

这是我的代码(与教程完全一样):

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()

但是当我执行它时出现以下异常:

有人可以解释一下这是什么问题吗? 我联系了 azure 支持,他们告诉我他们不能为我做任何事 ...

此外,我使用教程中推荐的 python 包:https://github.com/Azure/azure-storage-python 最新版本。

该错误与您的帐户密钥不正确有关。 Azure 存储密钥采用 base64 编码。您提供的字符串 ("account_key") 未正确进行 base64 编码,因此出现 Incorrect padding 错误。使用门户中提供的完整帐户密钥(主要或次要)再次尝试运行。