Getting Insufficient privileges to complete operation 从terraform创建服务主体时出错

Getting Insufficient privileges to complete the operation error while creating service principal from terraform

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

│ 
│   with module.appregister.azuread_application.auth,
│   on modules/appregister/main.tf line 6, in resource "azuread_application" "auth":
│    6: resource "azuread_application" "auth" {
│ 
│ ApplicationsClient.BaseClient.Post(): unexpected status 403 with OData
│ error: Authorization_RequestDenied: Insufficient privileges to complete the
│ operation.
╵
##[error]Error: The process '/agent/_work/_tool/terraform/1.0.3/x64/terraform' failed with exit code

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

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

至少,我认为您的服务负责人应该在 Application Administrator or Application Developer. For a list of complete Azure AD built-in roles, please see this link: https://docs.microsoft.com/en-us/azure/active-directory/roles/permissions-reference.