尝试从密钥保管库读取机密时出现 AccessToKeyVaultDenied 错误

问题描述 投票:0回答:1

我有一个使用基于角色的访问控制 (RBAC) 的 Azure Key-Vault。在这个密钥库中,我有一个秘密,我正在尝试将其注入功能应用程序中。

在密钥保管库中,我在 IAM 中有以下设置:

此外,在密钥本身的 IAM 设置中,我有以下内容:

最后,在函数应用程序本身中,我定义了一个值为

@Microsoft.KeyVault(SecretUri=https://kv-fuxxxnd.vault.azure.net/secrets/nile-estate-test-key/f63cxxxxxx5b2)
的应用程序设置。但是,我收到错误
AccessToKeyVaultDenied

有任何提示如何解决这个问题吗?我读到我需要为我的应用程序授予

LIST
GET
权限,但它似乎不起作用,因为密钥保管库使用 RBAC 方法。缺少什么?

azure-functions azure-keyvault
1个回答
0
投票

我尝试在我的环境中复制相同的内容,但这似乎不受消费计划功能应用程序的支持。

  • 我已经使用应用程序服务计划创建了功能应用程序。

  • Function app=>Settings=>Identity
    中启用系统分配的身份。

  • 创建了具有 RBAC 访问权限的 Key Vault:

enter image description here

  • 我已将以下角色分配给密钥保管库:
1. Owner
2. Key Vault Administrator
3. Key Vault Certificates Officer

enter image description here

  • 授予 所有者对 Key Vault 中功能应用程序的访问权限
  • 在 Key Vault 中创建秘密:

enter image description here

  • Function App=>Settings=>Environment variables
    :
  • 中添加了密钥保管库参考作为应用程序设置

密钥库参考:

@Microsoft.KeyVault(SecretUri=https://kpkvault.vault.azure.net/secrets/<secretname>/<SecretVersion>)

enter image description here

  • 能够成功添加引用:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.