title: Terraform - Retrieve Azure AD Group Member Name
body: <br>
  In my Terraform configuration, I want to obtain the names of all members of an Azure AD Group called "`VaultUsers`" and then read and display the result from my Terraform output file called `outputs.tf`.
  <p>I have two snippets of Terraform configuration that complete part of the above task, as described below.</p>
  <p><strong>[ Snippet 1 ]</strong></p>
  <p>This first code block will display the object ids of the group members. Unfortunately, the <code>test.group.</code> object does not include a property to display the group member names and so for now, I'm simply displaying the Azure AD object id of each group member by using the notation - <code>data.azuread_group.test_group.members</code>.</p>
  <pre><code>data &quot;azuread_group&quot; &quot;test_group&quot; {
    display_name = &quot;VaultUsers&quot;
  }
  
  output &quot;azuread_groups_root-users&quot; {
    value = data.azuread_group.test_group.members
  } 
  </code></pre>
  <br>
  The second snippet (below) on the other hand, will display a large chunk of Azure AD metadata for each group member, including the following:
  <pre><code> + mail_nicknames
   + object_ids
   + user_principal_names
  </code></pre>
  <p><strong>[ Snippet 2 ]</strong></p>
  <pre><code>data &quot;azuread_users&quot; &quot;users&quot; {
   return_all = true
  }
  
  output &quot;azuread_groups_root-user-members&quot; {
    value = data.azuread_users.users
  }
  </code></pre>
  <p>Crucially, it also displays the below additional metadata in a <code>users</code> block and ultimately, it is the <code>display_name</code> value that I'm desperately seeking to extract. Any idea or suggestions on how I can achieve this?</p>
  <br> 
  <p><a href="https://i.stack.imgur.com/9m5uO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9m5uO.png" alt="enter image description here" /></a></p>