使用其他订阅时无法在 Azure 上部署基础设施

Unable to deploy infra on azure while using another subscription

我使用 2 个订阅,在此之前我只在其中一个上实施,但现在我需要在第二个上实施,即生产单元。 在 Azure Devops 中,我为 armServiceConnection.

添加了服务连接名称

我认为这可以通过向资源组添加一个具有 Contributor 角色的角色分配来解决,但是如何将“订阅”添加为“名称”,我只能找到电子邮件和一些组。

其他日志:

Error: resources.GroupsClient#Get: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403 Code="AuthorizationFailed" Message="The client '8347968f-b300-4f88-8354-2688f6abeeda' with object id '8347968f-b300-4f88-8354-2688f6abeeda' does not have authorization to perform action 'Microsoft.Resources/subscriptions/resourcegroups/read' over scope '/subscriptions/19d0884f-4732-4c3b-91ea-0d78b603bec0/resourcegroups/rg-opendata-prd' or the scope is invalid. If access was recently granted, please refresh your credentials."
│ 
│   with data.azurerm_resource_group.rg,
│   on main.tf line 3, in data "azurerm_resource_group" "rg":
│    3: data "azurerm_resource_group" "rg" {
│ 
╵
##[error]Script failed with exit code: 1

如果您转到服务连接详细信息,您可以单击并转到您的服务主体:

从那个地方您可以轻松添加适当的权限。