Azure 密钥保管库 - WebApp 在 select 主体中不可见

Azure key vault - WebApp is not visible in select principal

我们有 2 个订阅

我们能够分配 webapp 以允许访问 Key Vault 以获取凭据及其通过 Key Vault -> 访问策略 -> 添加新 -> Select Principal

正常工作

通过 UAT 订阅,当我们想要 select 允许访问读取凭据时,WebApp 不会列出。 我可以看到列出了 APIM,但没有列出 webapp。

我检查了应用服务计划,其他默认配置,看起来都一样。

是否有更多规则适用于列表?

当您为您的网络应用程序启用密钥保管库的访问策略时,网络应用程序和密钥保管库应该在同一个租户中。摘自 this doc.

When you create a new key vault in a subscription, it is automatically tied to the default Azure Active Directory tenant ID for that subscription. All access policy entries are also tied to this tenant ID. When you move your Azure subscription from tenant A to tenant B, your existing key vaults are inaccessible by the principals (users and applications) in tenant B. To fix this issue, you need to:

  • Change the tenant ID associated with all existing key vaults in this subscription to tenant B.
  • Remove all existing access policy entries.
  • Add new access policy entries that are associated with tenant B.

例如,如果订阅中的密钥保管库 'myvault' 已从租户 A 移动到租户 B,下面介绍了如何更改此密钥保管库的租户 ID 并删除旧的访问策略。

Select-AzSubscription -SubscriptionId YourSubscriptionID
$vaultResourceId = (Get-AzKeyVault -VaultName myvault).ResourceId
$vault = Get-AzResource –ResourceId $vaultResourceId -ExpandProperties
$vault.Properties.TenantId = (Get-AzContext).Tenant.TenantId
$vault.Properties.AccessPolicies = @()
Set-AzResource -ResourceId $vaultResourceId -Properties $vault.Properties

如果您想了解将资源移动到新的资源组或订阅,请阅读 here

Azure 门户中的身份状态处于 "Off" 模式 Webapp -> 设置 -> 身份

我改成"On"保存了

现在我可以在 select 主要选项中看到 webapp。