您如何安全地检索存储帐户键?

发布于 2025-01-31 07:31:16 字数 896 浏览 3 评论 0原文

我正在尝试在存储帐户中的容器上编程设置访问策略。理想情况下,我想使用托管身份来执行此操作,但是目前看来它不支持(请参阅在这里)。

因此,目前看来我需要使用存储帐户密钥,以便容器客户端可以创建访问策略。这使我进入了我问题的主要部分。将这些密钥存储在钥匙库中并使用托管身份将其检索或直接检索它们是最佳实践吗?将钥匙保留在这样的钥匙保险库中,如遗产尽管(或者也许只是那些特定的方法,因为Azure CLI也是遗产)。因此,看来这已经陷入了以某种方式的裂缝中,因为它在1处被称为遗产,但在另一个地方尚未得到支持。

如果我选择直接路线,那么最好的方法是什么?在这种情况下,我仍然可以使用托管身份吗?看在这里可以,因为它使用Azure Active Directory,这就是我相信背部托管身份的方法。

目前,我应该如何将访问策略设置为容器,这是令人困惑的,但是希望其他人遇到了这一需求,并且有一个很好的例子。

I'm trying to programmatically set access policies on containers within a storage account. Ideally I'd like to do this using Managed Identity but it looks like it's not support at the moment (see here).

So at present it looks like I need to use the storage account key so the container client can create access policies. This brings me to the main part of my question. Is it best practice to store these keys in key vault and retrieve them using the managed identity or retrieve them directly? Keeping keys in key vault like this is stated as legacy though (or perhaps it's just those specific methods as Azure CLI is legacy as well). So it looks like this has fallen through the cracks somehow in that in 1 place it's stated as legacy but in another it's not supported yet.

If I opt for the direct route, what is the best way to do this? Can I still use the managed identity in this case? Looking here it looks like I can, as it uses Azure Active Directory, which is what I believe backs managed identity.

At the moment it's very confusing how I should programmatically set access policies to a container, but hopefully someone else has come across this need and has got a good example.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

你与昨日 2025-02-07 07:31:16

如果我选择了直接路线,那么最好的方法是什么?

如您在问题中提到的那样,存储帐户 - 列表密钥 是获取存储帐户访问键的方法。

在这种情况下,我仍然可以使用托管身份吗?

是的,您肯定可以。请确保您的托管身份有权在存储帐户上执行列表键操作。 所有者贡献者角色肯定具有该许可,但您也可以选择 存储帐户贡献者 存储帐户关键操作员服务角色 角色,如果您不想分配托管身份的更强大的角色,例如所有者贡献者

If I opt for the direct route, what is the best way to do this?

As you mentioned in the question, Storage Accounts - List Keys is the way to go for fetching access keys for a storage account.

Can I still use the managed identity in this case?

Yes, you most certainly can. Please ensure that your Managed Identity has permissions to perform List Keys operation on the storage account. Owner and Contributor roles definitely have that permission but you can also opt for Storage Account Contributor or Storage Account Key Operator Service Role role if you do not want to assign your Managed Identity more powerful roles like Owner or Contributor.

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