In this blog post, I will show you how to export all your Azure Active Directory users to a CSV file using PowerShell. In this post, I will use the latest Microsoft Azure cross-platform PowerShell module which works on macOS, Windows and Linux.
Install-Module
To install the Azure PowerShell module, use the following cmdlet.
install-module az
Connect
To connect to Azure AD and Azure run the following cmdlet.
connect-azaccount
Export Users
To export, all my users to a CSV file I will run the following cmdlet.
Get-AzADUser | export-csv file.csv
If you only need to export the first 50 users you can use the following cmdlet.
Get-AzADUser -First 500 | export-csv file.csv
To export all the users after the first 5 users I will use the following cmdlet.
Get-AzADUser -Skip 5 | ft
Processing…
Success! You're on the list.
Whoops! There was an error and we couldn't process your subscription. Please reload the page and try again.