hashicorp / terraform-provider-azuread

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

Retrieve tenant display name from azuread_client_config? #1443

Open webstean opened 1 month ago

webstean commented 1 month ago

Community Note

Can we have a way to obtain the display name of the Azure/Entra ID tenant. data "azuread_client_config already has the tenant_id, what about adding "tenant_display_name?

New or Affected Resource(s)

Potential Terraform Configuration

data "azuread_client_config" "current" {}

output "tenant_display_name" {
  value = data.azuread_client_config.current.tenant_display_name
}
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

References

nbaju1 commented 1 month ago

The tenant ID is readily available on the service principal object. Retrieving the tenant display name will require a separate call to the organization endpoint and requires at minimum the Organization.Read.All permission. Perhaps better to implement the tenant object as a separate data source?