Azure Devops中的Terraform Init错误403

l3zydbqr  于 2023-08-07  发布在  其他
关注(0)|答案(1)|浏览(126)

我在Azure Devops上有一个项目,或者我试图运行terraform在另一个Azure租户(与我的Azure Devops租户不同)上部署资源,但是当我运行terraform init时,我收到以下错误:

Error: Failed to get existing workspaces: containers.Client#ListBlobs: Failure responding to request: StatusCode=403 -- Original Error: autorest returned/azure: Service an error. Status=403 Code="AuthenticationFailed" Message="The server failed to authenticate the request. Ensure that the authorization header value is properly formed, including the signature.

字符串

wnavrhmk

wnavrhmk1#

当您尝试进行身份验证的用户或服务主体在其他租户中没有在存储帐户级别分配**Storage Blob Data Owner roleStorage Blob Data Contributor role**角色时,会出现上述错误。
一种替代方法是在另一个租户中创建服务主体,该租户在您要使用terraform创建存储帐户或部署资源的订阅或资源组级别分配了参与者角色。
通过引用此Document.,在Azure AD中创建一个服务主体,并在另一个租户中使用客户端密码,在订阅或存储帐户级别分配参与者角色和存储Blob数据参与者角色,并使用它进行身份验证以创建或管理存储帐户,如下所示:-

我的main.tf文件:-

terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "3.8.0"
    }
  }
}

provider "azurerm" {
  subscription_id = "xxxxx97cb2a7"
  tenant_id = "xxxx4-99ed-af9038592395"
  client_id = "xxxxb838-6d26a31435cb"
  client_secret = "xxxxxfEGZ3ZgxRt8313-CS0ifbLE"
  features {}  
}

resource "azurerm_resource_group" "appgrp" {
  name     = "silicon-resrcgrp"
  location = "North Europe"
}

resource "azurerm_storage_account" "appstore566565637" {
  name                     = "siliconstrg543"
  resource_group_name      = azurerm_resource_group.appgrp.name
  location                 = azurerm_resource_group.appgrp.location
  account_tier             = "Standard"
  account_replication_type = "LRS"
  account_kind = "StorageV2"
}

字符串

Devops发布管道:-

x1c 0d1x的数据




入口:-

x1c4d 1x的

参考号:-

azure - Error: Failed to get existing workspaces: containers.Client#ListBlobs: - Stack Overflow

相关问题