gpt4 book ai didi

azure - 地形错误:Unable to list provider registration status with azure

转载 作者:行者123 更新时间:2023-12-03 06:19:00 24 4
gpt4 key购买 nike

我正在使用 terraform 开发我的小项目,当我运行 terraform plan 时,我收到此错误:无法列出提供程序注册状态,这可能是由于凭据无效或服务主体无权使用资源管理器 API,Azure 错误。我仔细检查了凭据和权限,但什么都不起作用

仔细检查凭据更新地形terraform 初始化和验证运行没有错误

最佳答案

According to the SO answer by Eat at Jones You need to give your service principal atleast contributor or Owner access at the Subscription or the resource group level where you’re trying to access or create resources with Terraform.

我尝试启动 azurerm terraform 资源提供程序,但没有在订阅或资源组级别为其分配任何贡献者角色,但得到了与您相同的错误代码,请参阅以下内容:-

enter image description here

According to the answer by Eat at Jones I assigned the Contributor role to the Service principal that I am using for authentication at the subscription level like below:-

enter image description here

enter image description here

Click on Review+assign and the Contributor role will be assigned to
the Service principal successfully.

分配角色后,我再次运行代码,如下所示,并创建了一个资源组,没有任何错误:-

I have used the below code from official terraform
document
and answer by Begin to authenticate my service principal in terraform with client secrets.

Complete terraform main.tf code:-


required_providers {

azurerm = {

source = "hashicorp/azurerm"

version = "3.8.0"

}

}

}



provider "azurerm" {

subscription_id = "<sub-id>"

client_id = "<client-id>"

client_secret = "<client-secret>"

tenant_id = "<tenant-id>"

features {}

}



resource "azurerm_resource_group" "appgrp" {

name = "app-grp"

location = "North Europe"

}


在终端中:-

terraform plan -out main.tfplan


输出:-

enter image description here

terraform apply


输出:-

enter image description here

门户:-

enter image description here

关于azure - 地形错误:Unable to list provider registration status with azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76027397/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com