【发布时间】:2021-01-28 08:35:18
【问题描述】:
当我们尝试使用带有 Azure Blob Storage v12.5.0 和 Azure core 1.8.2 的 python v12 sdk 从连接字符串创建 azure blob 客户端时,出现身份验证失败错误。
我用过 天蓝色存储 blob == 12.5.0 天蓝色核心 == 1.8.2
我尝试使用 Python v12 SDK 的连接字符串访问我的 Blob 存储帐户,但收到了上述错误。我运行的环境是 NixShell 中的 python venv。
调用blob_upload的代码如下:
blob_service_client = BlobServiceClient(account_url=<>,credential=<>)
blob_client = blob_service_client.get_blob_client(container=container_name,
blob=file)
我打印出了blob_client,看起来很正常。但是upload_blob的下一行给出了错误。
with open(os.path.join(root,file), "rb") as data:
blob_client.upload_blob(data)
报错信息如下
File "<local_address>/.venv/lib/python3.8/site-packages/azure/storage/blob/_upload_helpers.py", in upload_block_blob
return client.upload(
File "<local_address>/.venv/lib/python3.8/site-packages/azure/storage/blob/_generated/operations/_block_blob_operations.py", in upload
raise models.StorageErrorException(response, self._deserialize)
azure.storage.blob._generated.models._models_py3.StorageErrorException: Operation returned an invalid status 'Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.'
于是我打印出http put请求到azure blob storage,得到响应值为[403]
【问题讨论】:
标签: azure-storage azure-blob-storage nix azure-authentication