如何使用Azure键Vault Python SDK添加访问策略?

发布于 2025-02-11 14:31:04 字数 247 浏览 3 评论 0原文

我正在尝试找到一种将新的访问策略添加到Azure密钥库资源中的方法。

我的基本堆栈是pulumi(az​​ure-native),它不能提供这样做的功能。它仅允许在创建密钥保险箱资源时添加访问策略。

显然,有一些Python SDK用于使用Azure键保管库,但是我找不到使用它们来管理访问策略的方法。

是否有任何Azure密钥保险库Python SDK提供了将访问策略添加到密钥保险库中的方法?如果没有,我的选择是什么(替代解决方案)?

I'm trying to find a way to dynamically add new access policies to an Azure Key Vault resource.

My base stack is Pulumi (azure-native) which doesn't provide the functionality to do that; it only allows to add access policies when creating the Key Vault resource.

Apparently, there are some Python SDKs for working with Azure Key Vault, but I couldn't find a way to use them for managing access policies.

Does any of the Azure Key Vault Python SDKs provide a way to add access policies to Key Vault? If not, what are my choices (alternative solutions) here?

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

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

发布评论

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

评论(1

若沐 2025-02-18 14:31:04

管理关键保险库访问策略。

import pulumi
import pulumi_azure as azure

current = azure.core.get_client_config()
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_key_vault = azure.keyvault.KeyVault("exampleKeyVault",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    tenant_id=current.tenant_id,
    sku_name="premium")
example_access_policy = azure.keyvault.AccessPolicy("exampleAccessPolicy",
    key_vault_id=example_key_vault.id,
    tenant_id=current.tenant_id,
    object_id=current.object_id,
    key_permissions=["Get"],
    secret_permissions=["Get"])

Manages a Key Vault Access Policy.

import pulumi
import pulumi_azure as azure

current = azure.core.get_client_config()
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_key_vault = azure.keyvault.KeyVault("exampleKeyVault",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    tenant_id=current.tenant_id,
    sku_name="premium")
example_access_policy = azure.keyvault.AccessPolicy("exampleAccessPolicy",
    key_vault_id=example_key_vault.id,
    tenant_id=current.tenant_id,
    object_id=current.object_id,
    key_permissions=["Get"],
    secret_permissions=["Get"])

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