【问题标题】:Key Vault 403 during getting access via MSI token通过 MSI 令牌访问期间的 Key Vault 403
【发布时间】:2017-12-12 23:34:51
【问题描述】:

我需要通过 MSI 从我的密钥库获取访问令牌。

  1. 我按照guide 启用 MSI。 MSI 已启用且必要的 扩展程序已安装。
  2. 我执行此guide 来为我的 VM 添加 Key Vault 的访问控制。 VM 是 KeyVault 的贡献者
  3. 我尝试根据此guide 获取 AC,并在尝试访问 Key Vault 时得到 403。

详细步骤 3:

  1. curl http://localhost:50342/oauth2/token --data "resource=https://vault.azure.net" -H Metadata:true
  2. curl https://<YOUR-KEY-VAULT-URL>/secrets/<secret-name>?api-version=2016-10-01 -H "Authorization: Bearer <ACCESS TOKEN>"

当我运行第 2 步时,出现 403 错误。

我尝试将 'https://vault.azure.net' 替换为 'https://' 但又遇到另一个错误:

{"error":"invalid_resource","error_description":"AADSTS50001: The application named https://<YOUR-KEY-VAULT-URL> was not found in the tenant named <A tenant ID>.This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.\r\nTrace ID: 7365f8f5-791f-4131-88f8-9466cadc4d00\r\nCorrelation ID: e18e0e5e-966e-460b-9b61-16decf97dff4\r\nTimestamp: 2017-12-12 11:18:01Z","error_codes":[50001],"timestamp":"2017-12-12 11:18:01Z","trace_id":"7365f8f5-791f-4131-88f8-9466cadc4d00","correlation_id":"e18e0e5e-966e-460b-9b61-16decf97dff4"}

怎么了?

【问题讨论】:

    标签: azure azure-keyvault


    【解决方案1】:

    您必须在 Key Vault 的策略中添加 VM 服务主体。在 Key Vault 上拥有 Contributor 允许主体通过 ARM API 执行操作,但它需要访问的是 Key Vault API。这需要您在“策略”选项卡上为主体添加一些权限。

    【讨论】:

      猜你喜欢
      • 2018-08-24
      • 2019-01-22
      • 2020-04-21
      • 2020-05-23
      • 2020-01-06
      • 2019-06-09
      • 2018-09-26
      • 1970-01-01
      相关资源
      最近更新 更多