List All Users in a Microsoft 365 Tenant with Name and Email

Prev Next

Export every user's first name, last name, and email address from Entra ID using the admin center, Microsoft Graph, or PowerShell.

Complexity: Beginner. Impact: reporting + user-management + audit + low-risk + read-only.

Why use this workflow

Getting a complete, accurate list of every user in your Microsoft 365 tenant is one of the most common admin tasks. Whether you prepare a license audit, build a distribution list, hand a roster to HR, or validate that directory sync produces the right set of accounts, you need a clean export of first name, last name, and email address.

The Microsoft 365 admin center exposes this information on the Active users page, but the export uses a fixed schema. Microsoft Graph and the Microsoft.Graph PowerShell module give you full control over the fields returned, pagination, and filtering, which is what you want for larger tenants.

Run this workflow whenever you need a point-in-time snapshot of your directory for reporting, migration planning, or compliance evidence.

Expected outcomes

  • A CSV or on-screen list of every user in the tenant that shows givenName, surname, and mail (falling back to userPrincipalName when no primary SMTP address is set).
  • A repeatable method (manual, API, or scripted) that correctly paginates through the whole tenant.
  • A baseline that you can compare against future exports to track joiners, leavers, and account changes.

Risks and considerations

Watch out for

  • Guest vs. member accounts. The default /users endpoint returns both. If you want only employees, filter with $filter=userType eq 'Member'.
  • Missing mail values. Cloud-only accounts and unlicensed users often have mail set to null. Fall back to userPrincipalName so no row is blank.
  • Pagination. Graph returns at most 999 users per page. Follow @odata.nextLink until it is absent. Otherwise your export is silently truncated.
  • PII handling. The exported CSV contains personal data. Store it on an encrypted share, limit who can read it, and delete it when the task is complete. Do not email it unencrypted.
  • Throttling. On very large tenants, issue requests sequentially and respect Retry-After headers. You cannot parallelize the paged calls because each page depends on the previous nextLink.

Required permissions

PermissionWhy it's needed
User.Read.AllMinimum scope required to enumerate all users and read basic profile properties (givenName, surname, mail, userPrincipalName).
Directory.Read.AllAlternative broader scope if you also need to read related directory objects (groups, roles) in the same workflow.
Global Reader (role)For interactive admin center or PowerShell-with-delegated-auth usage, Global Reader is sufficient and avoids granting write privileges.

Ask Dex

Paste the prompt into a Dex conversation.

Prompt for IT admins

List every user in our Microsoft 365 tenant with first name, last name, and email address. Export the full list to CSV and flag any accounts missing a primary email so I can review them.

Manual steps (admin center)

This approach suits small tenants or a quick one-off export.

  1. Sign in to the Microsoft 365 admin center as a Global Reader, User Administrator, or Global Administrator.
  2. In the left navigation, go to Users > Active users.
  3. Select Export users at the top of the list. Confirm the prompt to generate a CSV.
  4. Open the downloaded CSV. The columns you need are First name, Last name, and Primary email address. You can delete the other columns in Excel if you want a slimmer report.

If you also want guest users

  1. Go to Users > Guest users and repeat the export, then combine the two CSVs.

When the admin center is not enough

For full control over fields and user types, use the Graph API or PowerShell approaches below.

Microsoft Graph API

Use the /users endpoint with $select to return only the fields you need, and follow @odata.nextLink to page through the entire tenant.

Request

GET https://graph.microsoft.com/v1.0/users?$select=givenName,surname,mail,userPrincipalName&$top=999
Authorization: Bearer <access_token>
ConsistencyLevel: eventual

Sample response

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
  "@odata.nextLink": "https://graph.microsoft.com/v1.0/users?$skiptoken=...",
  "value": [
    {
      "givenName": "Alex",
      "surname": "Example",
      "mail": "AlexE@contoso.onmicrosoft.com",
      "userPrincipalName": "AlexE@contoso.onmicrosoft.com"
    }
  ]
}

Pagination

If @odata.nextLink is present, issue another GET against that exact URL (it already contains the $skiptoken) until the property disappears from the response. Concatenate the value arrays to get the full user list.

Useful filters

  • Members only: &$filter=userType eq 'Member'
  • Enabled accounts only: &$filter=accountEnabled eq true (requires ConsistencyLevel: eventual and $count=true)
  • Licensed users only: combine with assignedLicenses/$count ne 0 through advanced queries

Permissions

Application or delegated scope User.Read.All (or Directory.Read.All). Admin consent is required for app-only flows.

PowerShell

The Microsoft.Graph.Users module wraps Graph pagination for you. Get-MgUser -All follows every nextLink.

One-time setup

# Install the module (run once)
Install-Module Microsoft.Graph -Scope CurrentUser

Connect and query

# Sign in with least-privilege scope
Connect-MgGraph -Scopes "User.Read.All"

# Retrieve all users, selecting only the fields we care about
$users = Get-MgUser -All -Property GivenName,Surname,Mail,UserPrincipalName `
    | Select-Object `
        @{Name='FirstName';Expression={$_.GivenName}},
        @{Name='LastName'; Expression={$_.Surname}},
        @{Name='Email';    Expression={ if ($_.Mail) { $_.Mail } else { $_.UserPrincipalName } }}

# Show on screen
$users | Format-Table -AutoSize

# Or export to CSV
$users | Export-Csv -Path ".\tenant-users.csv" -NoTypeInformation -Encoding UTF8

Disconnect-MgGraph

Notes

  • -All is essential. Without it, Get-MgUser returns only the first page.
  • The calculated Email column falls back to the UPN so rows are never blank.