从 terraform 创建服务主体时出现权限不足,无法完成操作的错误

Ash*_*mar 8 azure azure-active-directory terraform azure-devops terraform-provider-azure

我想使用 terraform 创建服务主体,并为此编写了 terraform 脚本。我有 Azure DevOps pipeline,我可以在其中运行该管道。我用来运行 terraform 脚本的服务主体具有订阅的所有者访问权限。我在创建天蓝色广告应用程序时遇到以下错误

\n
\xe2\x94\x82 \n\xe2\x94\x82   with module.appregister.azuread_application.auth,\n\xe2\x94\x82   on modules/appregister/main.tf line 6, in resource "azuread_application" "auth":\n\xe2\x94\x82    6: resource "azuread_application" "auth" {\n\xe2\x94\x82 \n\xe2\x94\x82 ApplicationsClient.BaseClient.Post(): unexpected status 403 with OData\n\xe2\x94\x82 error: Authorization_RequestDenied: Insufficient privileges to complete the\n\xe2\x94\x82 operation.\n\xe2\x95\xb5\n##[error]Error: The process '/agent/_work/_tool/terraform/1.0.3/x64/terraform' failed with exit code\n
Run Code Online (Sandbox Code Playgroud)\n

运行它需要什么样的权限?

\n

Gau*_*tri 8

考虑到服务主体是在 Azure AD 中创建的,用于运行 Terraform 脚本的服务主体需要在 Azure AD 中拥有适当的权限,而不是在 Azure 订阅中拥有适当的权限。

至少,我相信您的服务主体应该位于Application AdministratorApplication Developer。有关完整的 Azure AD 内置角色的列表,请参阅此链接: https: //learn.microsoft.com/en-us/azure/active-directory/roles/permissions-reference