Azure Blob存储:可以创建和删除容器 - 无法列出或读取斑点

发布于 2025-02-04 02:13:10 字数 694 浏览 0 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沉睡月亮 2025-02-11 02:13:10

您需要做的是向您的服务委托人提供有关数据与存储帐户的适当权限。请参阅此链接,以获取必须将其分配给服务主管执行数据相关操作的适当的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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文