【发布时间】:2019-06-28 13:32:09
【问题描述】:
问题陈述
目前,我正在借助 azure terraform 在不同订阅中创建/修改 azure 资源。
错误
Principal <appid> does not exist in the directory {destination-tenant-id-for which contribution role required}
考虑以下情况。
我们想在一个订阅中创建 Azure AKS 集群,并且在相同的执行中,我们想更新另一个订阅中的 DNS 定义。如果我们在同一个订阅中同时拥有 DNS 区域和 aks 集群,则此过程运行良好,但如果这两个资源在不同的订阅中,则此过程将不起作用。
采取的步骤
无需分配即可创建服务主体
az ad sp create-for-rbac -n sp-terraform-001 --skip-assignment
为当前订阅的当前 sp 分配贡献者角色
az role assignment create --assignee <appid> --role Contributor --scope /subscriptions/<sub-id>
*将贡献者角色分配给当前 sp 以获得不同的订阅。它会因 *
而失败az role assignment create --assignee <appid> --role Contributor --scope /subscriptions/<diff-sub-id>/<resource-group>....
请告诉我访问其他订阅资源的正确步骤
【问题讨论】:
-
错误是什么?
-
这些订阅是否在同一个 Azure AD 租户中?
-
这两个订阅都在不同的租户 ID 中。我收到错误,例如目录
中不存在 Principal 。根据这个错误,我假设我需要在目标订阅中添加新创建的 SP
标签: azure azure-active-directory