在 azure 中将存储帐户防火墙中的跨租户子网列入白名单

时间:2021-04-05 07:39:20

标签: azure azure-active-directory azure-storage multi-tenant web-application-firewall

我想从位于其他 Azure AD 租户(例如租户 ID T2)中的子网(例如 S1)访问位于 Azure AD 租户(例如租户 ID T1)中的存储帐户。使用 azure CLI,我能够在存储帐户的防火墙和虚拟网络选项卡中添加这个现有的通风口/子网。

AZ CLI:az storage account network-rule add -g myRG --account myAccount --subnet mySubnetId

但是此子网的端点状态显示权限不足而不是启用。因此无法从添加的子网 S1 访问此存储帐户。

错误: Unable retrieve endpoint status for one or more subnets. Status 'insufficient permissions' indicates lack of subnet read permissions ('Microsoft.Network/virtualNetworks/subnets/read').

详细错误:

You do not have authorization to access this resource.

Resource ID: /subscriptions/****/resourceGroups/my-network-rg/providers/Microsoft.Network/virtualNetworks/my-vnet

Status Code: 401

Status Message: The access token is from the wrong issuer 'https://sts.windows.net/T1/'. It must match the tenant 'https://sts.windows.net/T2/' associated with this subscription. Please use the authority (URL) 'https://login.windows.net/T2' to get the token. Note, if the subscription is transferred to another tenant there is no impact to the services, but information about new tenant could take time to propagate (up to an hour). If you just transferred your subscription and see this error message, please try back later.

我缺少哪些必要的跨租户权限?如何提供它们?任何帮助表示赞赏。虽然这可能是微不足道的,因为我是 Azure 的新手,我不确定我在这里错过了什么。谢谢。

1 个答案:

答案 0 :(得分:1)

您已正确执行所有步骤,这只是令人困惑的消息:您使用从租户 1 获得令牌的用户登录到 Azure 门户,但 VNet 驻留在租户 2 中,而您没有令牌可用于读取租户 2 中的子网数据。

要确认网络规则实际上设置正确,您可以运行

az storage account network-rule list --account-name myAccount

您应该会看到一个 "state": "Succeeded"

剩下要做的唯一事情是确保访问来自子网的存储帐户的用户帐户具有 eligible role 分配来访问存储帐户。因此,例如,如果用户应该能够读取和写入 Blob 数据,请为您的用户添加 Storage Blob Data Contributor 角色。