Export AAD Users to CSV
Require to export AAD Users to CSV then we have you covered. I have had this request numerous different times. However, in my experience its most commonly for HR when licensing figures are screwed vs HR employee count. Which is possible the same reason you have even landed on this page today.

How To: Export AAD Users to CSV
Firstly, we have to connect to Azure AD via PowerShell to complete this task. This can be completed by running the below command. You will have to then authenticate with an admin account with sufficient privileges. Please note if you only return yourself as a user then you do not have appropriate permissions.
Connect-AzureAD
Secondly. once connected the below command will pull back all Azure AD Users and select the attributes for UserPrincipalName and Mail and store it under the variable $Data.
$Data = Get-AzureADUser -All $true | Select-Object UserPrincipalName,Mail
If you run the below command you can verify the data captured to see if this is as required. Also, its common practice to do this prior to the export to ensure your happy with the data.
$Data
Finally, running the following command will export all the details stored in the variable $Data to CSV file
$Data | Export-Csv C:\Temp\UserExport.CSV -NoTypeInformation -Encoding UTF8
The below is copied directly from the CSV Exported above to demo what you expect the CSV to look like.
UserPrincipalName | |
AdeleV@TheTechEvolution.com | Adele.Vance@TheTechEvolution.com |
AlexW@TheTechEvolution.com | Alex.Wilber@TheTechEvolution.com |
Blogs@TheTechEvolution.com | Blogs@TheTechEvolution.com |
Daniel.Dev2@TheTechEvolution.com | Daniel.Dev2@TheTechEvolution.com |
DaveB@TheTechEvolution.com | Dave.Barry@TheTechEvolution.com |
DiegoS@TheTechEvolution.com | DiegoS@TheTechEvolution.com |
GradyA@TheTechEvolution.com | GradyA@TheTechEvolution.com |
HenriettaM@TheTechEvolution.com | HenriettaM@TheTechEvolution.com |
IsaiahL@TheTechEvolution.com | IsaiahL@TheTechEvolution.com |
JohannaL@TheTechEvolution.com | JohannaL@TheTechEvolution.com |
JoniS@TheTechEvolution.com | JoniS@TheTechEvolution.com |
LeeG@TheTechEvolution.com | LeeG@TheTechEvolution.com |
LidiaH@TheTechEvolution.com | LidiaH@TheTechEvolution.com |
LynneR@TheTechEvolution.com | LynneR@TheTechEvolution.com |
MeganB@TheTechEvolution.com | MeganB@TheTechEvolution.com |
MiriamG@TheTechEvolution.com | MiriamG@TheTechEvolution.com |
NestorW@TheTechEvolution.com | NestorW@TheTechEvolution.com |
PattiF@TheTechEvolution.com | PattiF@TheTechEvolution.com |
PradeepG@TheTechEvolution.com | PradeepG@TheTechEvolution.com |
Hopefully the above has helped you export all Users to CSV and completed the task you landed on this page for in the first place.
Additional Details: Azure AD
If you want to find more details please visit the attached tech net article from Microsoft for more details.
Also, if you want to find more details out on how AAD Connect please check out my other blog posts. Furthermore being from a consultant in this area. Shortly, I am hoping to have numerous blog posts on the AAD Connect subject and Transformation rules.
Finally please feel free to drop a comment below or share this blog post if it has helped you.
Please Leave a Comment
If the above has helped you in increase the efficiency in a mailbox migration then please let us know by leaving a comment or feel free to share the article below. If you have any errors or require more details on anything covered then please comment.