Terraform azurerm_data_factory vsts_configuration failing with Error: Error configuring Repository for Data Factory

Terraform azurerm_data_factory vsts_configuration failing with Error: Error configuring Repository for Data Factory

我正在尝试使用 Terraform 在 Azure 数据工厂中设置代码存储库,通过 Azure Cloud Shell 进行部署,贡献者访问权限如下:https://www.terraform.io/docs/providers/azurerm/r/data_factory.html#vsts_configuration

我收到错误消息:

Error: Error configuring Repository for Data Factory "adf-name" (Resource Group "rg-name"): datafactory.FactoriesClient#ConfigureFactoryRepo: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403 Code="AuthorizationFailed" Message="The client 'xxx@xxx.com' with object id 'xxxxx' does not have authorization to perform action 'Microsoft.DataFactory/locations/configureFactoryRepo/action' over scope '/subscriptions/xxxxxx' or the scope is invalid. If access was recently granted, please refresh your credentials.

我已经对客户端、对象 ID 和范围脱敏了。

我能够在门户中设置代码存储库,但是当我尝试 运行 Azure Cloud Shell 中的 terraform 时失败了。有没有人以前见过此错误消息或知道如何克服它?

代码片段:

`provider "azurerm" {
  version = "=2.3.0"
  features {}
}
resource "azurerm_data_factory" "example" {
  name                = var.adf_name
  location            = var.location
  resource_group_name = var.rg_name
  vsts_configuration {
    account_name      = var.account_name
    branch_name       = var.branch_name
    project_name      = var.project_name
    repository_name   = var.repo_name
    root_folder       = var.root_folder
    tenant_id         = var.tenant_id
  }
}`

必须为操作“Microsoft.DataFactory/locations/configureFactoryRepo/action”添加自定义角色并将其分配给服务主体。贡献者角色本身不足以使用 Terraform azurerm 为 Azure 数据工厂设置代码存储库。