简体   繁体   中英

How to create appRoles with azurerm provider on terraform

I'm trying to setup my azure infrastructure using Terraform which was pretty successful so far. Our app development team needs to define application specific roles within the AzureAD application's manifest which we currently handling with the Azure Portal by simply modifying the manifest:

"appRoles": [
    {
        "allowedMemberTypes": [
        "Application"
        ],
        "displayName": "SurveyCreator",
        "id": "1b4f816e-5eaf-48b9-8613-7923830595ad",
        "isEnabled": true,
        "description": "Creators can create Surveys",
        "value": "SurveyCreator"
    }
]

Using Terraform I created an azurerm_azuread_application and now want to modify the manifest accordingly.

resource "azurerm_azuread_application" "test" {
  name                       = "APP"
  homepage                   = "http://APPHOMEPAGE"
  identifier_uris            = ["http://APPHOMEPAGE"]
  reply_urls                 = ["http://APPHOMEPAGE/REPLYURL"]
  available_to_other_tenants = false
  oauth2_allow_implicit_flow = false
}

Is there a way to achieve this by using Terraform only?

To create the App role, you could refer to azuread_application_app_role .

resource "azuread_application" "example" {
  name = "example"
}

resource "azuread_application_app_role" "example" {
  application_object_id = azuread_application.example.id
  allowed_member_types  = ["User"]
  description           = "Admins can manage roles and perform all task actions"
  display_name          = "Admin"
  is_enabled            = true
  value                 = "administer"
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM