Who are the licensed users in our tenant and what licenses are assigned to them? This question comes up way too often in several scenarios and there are a few methods to determine this. I will go over those in this post. I’ve updated this post with some newer information about exporting from the admin portal when I learned them.
Using PowerShell
There are two versions of the PowerShell module that you can use to connect to Microsoft 365 and administer user accounts, groups, and licenses:
- Microsoft Azure AD Module for Windows PowerShell, whose cmdlets include Msol in their name
- Azure AD PowerShell for Graph, whose cmdlets include AzureAD in their name
Please make sure you have the MSOnline Module for PowerShell installed and loaded
The Get-MsolUser is a powerful cmdlet which provides a lot of details and I’m going to use it for determining the user’s license.
To connect to the service,
$credential = Get-Credential -credential "adminuser@tenant.onmicrosoft.com"
Connect-MsolService -credential $credential
To get all (licensed and unlicensed) users,
Get-MsolUser -All
To list only licensed users,
Get-MsolUser -All | Where {$_.isLicensed -eq $true}
To list unlicensed users,
Get-MsolUser -All -UnlicensedUsersOnly
To export all users to a csv with their user name, license status and license assigned,
Get-MsolUser -All | Where {$_.isLicensed -eq $true} | Select Displayname,userprincipalname,islicensed,{$_.Licenses.AccountSkuId} | Export-csv "C:\tmp\userlist.csv" -NoTypeInformation
The exported csv will look like this,
Using the O365 admin portal
Microsoft has enabled exporting licensing information from the portal.
- Login to O365 admin center
- Users –> Active Users
- Click Export Users
- Click Continue
This is how the csv output looks like,
Thank you for stopping by. ✌