Sometimes it can come in handy to have a list of all users with a license in Office 365. Unfortunately the admin gui does not provide such a query. So once again Powershell comes to our rescue.

Make sure you connect Powershell to your Office365 tennant first.

Get-MsolUser | where-object { $_.IsLicensed -eq "TRUE" } | Select-Object UserPrincipalName, DisplayName, Country, Department | Export-Csv c:\temp\users.csv