title: Microsoft Graph API with Azure AD B2C: Get all users and their group membership
body: <p>We are trying to retrieve a list of all users in our B2C directory, and include the group memberships for all users.</p>
  <p>We found this query, but unfortunately it is not supported for B2C:</p>
  <pre><code>https://graph.microsoft.com/v1.0/users?$select=displayname&amp;$expand=memberof
  </code></pre>
  <p>Are there any workarounds for a B2C tenant?</p>
  <p>We've considered two solutions, but neither are scalable:</p>
  <ol>
  <li>iterating over each user and retrieving their membership</li>
  <li>iterating over all known groups and retrieving members</li>
  </ol>