hashicorp / terraform-provider-azuread

Terraform provider for Azure Active Directory
https://registry.terraform.io/providers/hashicorp/azuread/latest/docs
Mozilla Public License 2.0
417 stars 283 forks source link

How to use `azuread_application_pre_authorized` with the authorizing application being msgraph #1348

Closed penenkel closed 3 months ago

penenkel commented 3 months ago

With the application_object_id argument being deprecated and the new application_id argument expecting a resource id (i.e. a terraform application id?), how can I specify MicrosoftGraph?

I have tried

penenkel commented 3 months ago

The correct answer is: you don't, use azuread_app_role_assignment instead.

resource "azuread_app_role_assignment" "example_app_may_acsess_msgraph_to_send_mail" {
  app_role_id         = data.azuread_service_principal.msgraph.app_role_ids["Mail.Send"]
  principal_object_id = azuread_service_principal.example_app.object_id
  resource_object_id  = data.azuread_service_principal.msgraph.object_id
}

As an explanation: