Azure Blob存储:可以创建和删除容器 - 无法列出或读取斑点
from azure.identity import DefaultAzureCredential
from azure.storage.blob import BlobServiceClient
credentials = DefaultAzureCredential()
blob_service_client = BlobServiceClient(
account_url='https://XYZ.blob.core.windows.net',
credential=credentials
)
DefaultazureCrecrecreCredential
获取我通过VS代码Azure帐户插件登录的凭据。我登录的用户具有贡献者特权 - 这些是由DefaultazureCrecrecreCredential
选择的凭据相同。
在插件中,我可以列出并阅读所有斑点。
使用上述Blob_Service_client
我可以在相应的存储帐户中创建和删除容器。
任何打算列出或读取BLOB的操作都会使用content:<?xml版本=“ 1.0”编码=“ utf-8”? ; Message>该请求无权使用此权限执行此操作。
。
所有库和插件都是最新版本。
关于如何解决这一问题的任何暗示,都将受到广泛赞赏。
from azure.identity import DefaultAzureCredential
from azure.storage.blob import BlobServiceClient
credentials = DefaultAzureCredential()
blob_service_client = BlobServiceClient(
account_url='https://XYZ.blob.core.windows.net',
credential=credentials
)
The DefaultAzureCredential
fetches my credentials I logged in with through my VS Code Azure Account plugin. The user I am logged in with has Contributor privileges - these are the same credentials picked up by DefaultAzureCredential
.
Within the plugin I can list and read all the blobs.
With the above blob_service_client
I can create and delete containers in the respective storage account.
Any operation that intends to list or read a blob fails with Content: <?xml version="1.0" encoding="utf-8"?><Error><Code>AuthorizationPermissionMismatch</Code><Message>This request is not authorized to perform this operation using this permission.
.
All libraries and plugins are the latest version.
Any hint as to how to resolve this would be massively appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要做的是向您的服务委托人提供有关数据与存储帐户的适当权限。请参阅此链接,以获取必须将其分配给服务主管执行数据相关操作的适当的RBAC角色: https://learn.microsoft.com/en-us/rest/rest/rest/api/storageservices/authorize-with-with-azure - 主动指导#manage-manch-access-rights-with-rbac 。
What you would need to do is give appropriate data related permissions to your Service Principal on a Storage Account. Please see this link for the appropriate RBAC roles that you must assign to your Service Principal to perform data related operations: https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-with-azure-active-directory#manage-access-rights-with-rbac.