I would like to retrive the Managed Identity Application ID from my adf using the data sources
. I have tried this
provider "azurerm" {
features {}
}
data "azurerm_data_factory" "adf" {
name = "adf-dev-gg-we-01"
resource_group_name = "your_resource_group_name"
}
output "managed_identity_application_id" {
value = data.azurerm_data_factory.adf.identity[0].principal_id
}
but it retrives Managed Identity Object ID
but I would like to get the Managed Identity Application ID
! How can I achieve this?
You cannot directly retrieve the managed identityclient_id
value from a resource. Instead use data source of an azuread_service_principal
to get it as shown below.
provider "azurerm" {
features {}
}
data "azurerm_data_factory" "adf" {
name = "newdfj"
resource_group_name = "Jahnavi"
}
data "azuread_service_principal" "example" {
object_id = data.azurerm_data_factory.adf.identity.0.principal_id
}
output "managed_identity_application_id" {
value = data.azuread_service_principal.example.client_id
}
Value to be shown:
Output: