How to fetch Azure Security Insights Object ID from terraform?

To get the objectId of Azure Security Insights App which is present in Enterprise Applications of Azure Active directory via terraform, you can make use of below code:

data "azuread_service_principal" "security_insights_app" {
  display_name = "Azure Security Insights"
}

output "security_insights_app_object_id" {
  value = data.azuread_service_principal.security_insights_app.object_id
}

I have Azure Security Insights app in Enterprise Applications of my tenant like below:

enter image description here

When I ran below terraform code, I got ObjectID of Azure Security Insights app in response successfully like below:

data "azuread_service_principal" "security_insights_app" {
  display_name = "Azure Security Insights"
}

output "security_insights_app_object_id" {
  value = data.azuread_service_principal.security_insights_app.object_id
}

Response:

enter image description here

Read more here: Source link