terraform-provider-azuread
terraform-provider-azuread copied to clipboard
Add support for "mail" lookup
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritise this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritise the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
The following also works so if we had a mail option for the data "azuread_user" this would solve the issue. It should throw an error if it detects that the query will return more than one result.
az ad user list --filter "mail eq '[email protected]'"
New or Affected Resource(s)
- data azuread_user
Potential Terraform Configuration
data "azuread_user" "YYYY" {
mail = "[email protected]"
}
References
- #275
Hi @trajano, I'm looking at adding this and have an untested implementation. However, we're currently unable to test this due to the mail
field being (a) readonly and (b) only populated for users with an O365 license. I'll look further into this.
I'm actually just using the Terraform azuread to help manage my Office 365 installation (rather than an Azure system)
Our workaround for now
data "azuread_user" "ContractorDevelopers" {
for_each = merge(
{ for e in csvdecode(file("data/ContractorDevelopers.csv")) : e.Email => "${replace(e.Email, "@", "_")}#EXT#@${var.tenant_domain}" }
)
user_principal_name = each.value
}
Where the CSV file contains e-mail addresses only. no other fields.
This functionality has been released in v2.37.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!