Skip to content

Export Microsoft 365 users licenses

In Microsoft 365 admin center, you can export a list of users with each of their licenses. However, this list does not show the details of the assigned licenses and apps of all users. Therefore, you must click on each user in the Microsoft admin center to get information about their licenses, which costs time. A better way to export Microsoft 365 users licenses report is with PowerShell. In this article, you will learn how to export all Microsoft 365 user licenses with Exchange Online PowerShell.

Get users licenses in Microsoft 365

We want to show you how to export user licenses in Microsoft 365 admin center.

Export licensed users in Microsoft 365 admin center

Follow the steps below to get all licensed users in Microsoft 365:

  1. Sign in to Microsoft 365 admin center
  2. On the navigation menu, click Billing
  3. Click Licenses
  4. Click on the number under Assigned licenses
  5. Or click Organization under Account type
View Microsoft 365 users licenses list
  1. It shows a list of all the users with licenses. Now you can export the list of users with licenses to an Excel CSV file.

You need to find your Excel skills to sort and filter the data. It does not show you information about which assigned apps each user license has.

View licenses for one user

To view the licenses for a single user, you need to click on each Microsoft 365 user to see which licenses and apps they have assigned.

Export Microsoft 365 for one user licenses and apps services

In Microsoft 365 admin center, you can’t export a list of all the users’ licenses and apps. So you can’t find which licensed user has enabled or disabled an app like Yammer Enterprise.

Note: Each user can have multiple licenses, and each license has access to numerous apps. Some users might not have enabled access to all the apps of each license. Unfortunately, this can only be seen if you click on each user to get the details. That’s when PowerShell comes to the rescue.

Therefore you need to use the Export-Microsoft365LicenseStatus.ps1 PowerShell script that we will show in the next step. It is faster and easier to use that script that reports all licensed users with the assigned licenses and status.

Connect to Microsoft Graph PowerShell

Before we start, you need to install the Microsoft Graph PowerShell module and connect to Microsoft Graph with your admin account.

Run the Connect-MgGraph cmdlet.

Connect-MgGraph -Scopes "Organization.Read.All","User.ReadWrite.All"

The sign in to your account window will appear. Enter your password, and click Sign in

Export Microsoft 365 users licenses sign in

If this is the first time you have installed Microsoft Graph PowerShell, you might get the permissions requested verification like the below picture.

Select the checkbox Consent on behalf of your organization and click Accept.

Microsoft Graph PowerShell verification

After completing the verification, you must go back to the PowerShell window. You will see this text below.

PS C:\> Connect-MgGraph -Scopes "Organization.Read.All","User.ReadWrite.All"
Welcome To Microsoft Graph!

Install PowerShell 7

For this script to work, you must install PowerShell 7 on Windows. Otherwise, you will get a warning like the one below.

Setup : This script supports only PowerShell 7.  Please try again using PowerShell 7.
At C:\scripts\Export-Microsoft365LicenseStatus.ps1:195 char:5
+     Setup
+     ~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Setup

Download Export Microsoft 365 License Status PowerShell script

Download the Export-Microsoft365LicenseStatus.ps1 PowerShell script and save it in the C:\scripts folder. Next, create a folder named temp in the (C:) drive.

Export all Microsoft 365 users licenses report

Use the below command to export all users’ licenses status in PowerShell.

C:\scripts\.\Export-Microsoft365LicenseStatus.ps1 -All

You will get a pop-up window to know if you want to continue. Click Yes.

Export Microsoft 365 users licenses script

The result will be a long list. It shows all the users’ licenses and the apps they have enabled. Of course, you can copy the list and paste it into Notepad or any other application.

UserPrincipalName  : Amanda.Morgan@exoip.com
DisplayName        : Amanda Morgan
Department         : IT
UsageLocation      : NL
SkuPartNumber      : DEVELOPERPACK_E5
ServicePlanName    : VIVA_LEARNING_SEEDED
ProvisioningStatus : Success

UserPrincipalName  : Amanda.Morgan@exoip.com
DisplayName        : Amanda Morgan
Department         : IT
UsageLocation      : NL
SkuPartNumber      : DEVELOPERPACK_E5
ServicePlanName    : Nucleus
ProvisioningStatus : Success

UserPrincipalName  : Amanda.Morgan@exoip.com
DisplayName        : Amanda Morgan
Department         : IT
UsageLocation      : NL
SkuPartNumber      : DEVELOPERPACK_E5
ServicePlanName    : MIP_S_Exchange
ProvisioningStatus : Success

UserPrincipalName  : Amanda.Morgan@exoip.com
DisplayName        : Amanda Morgan
Department         : IT
UsageLocation      : NL
SkuPartNumber      : DEVELOPERPACK_E5
ServicePlanName    : MICROSOFT_COMMUNICATION_COMPLIANCE
ProvisioningStatus : Success

Export all Microsoft 365 users licenses report to CSV

You can also export all Microsoft users’ licenses to a CSV file. This way, you can search for the different licenses or apps enabled for each user.

First, you must connect to Microsoft Graph as mentioned above.

Then use the below PowerShell command to export all users’ information to a CSV file.

C:\scripts\.\Export-Microsoft365LicenseStatus.ps1 -All | Export-Csv "C:\Temp\LicenseReport.csv"

In PowerShell you need to press Y followed by enter.

PS C:\> C:\scripts\.\Export-Microsoft365LicenseStatus.ps1 -All | Export-Csv "C:\Temp\LicenseReport.csv"

This script runs Get-MgUser to get all users and Get-MgUserLicenseDetail for all users. It may take long time to
complete, or execution may fail due to Microsoft Graph throttling.
Do you really want to continue?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y

Once you export the information, you can find the CSV file in the C:\temp folder.

Open the CSV file with an application like Microsoft Excel to see the results.

Export Microsoft 365 users licenses CSV folder

Export specific Microsoft 365 user license details with PowerShell

You can also export a specific user’s license information in PowerShell using the command below.

In our example, we want to get the license information of Carol Baker.

C:\scripts\.\Export-Microsoft365LicenseStatus.ps1 -UserPrincipalName "Carol.Baker@exoip.com"

In our example, the result in PowerShell will look like this. You can copy the list and paste it into Notepad or any other application to save the information.

UserPrincipalName  : Carol.Baker@exoip.com
DisplayName        : Carol Baker
Department         : 
UsageLocation      : NL
SkuPartNumber      : DEVELOPERPACK_E5
ServicePlanName    : VIVA_LEARNING_SEEDED
ProvisioningStatus : Success

UserPrincipalName  : Carol.Baker@exoip.com
DisplayName        : Carol Baker
Department         : 
UsageLocation      : NL
SkuPartNumber      : DEVELOPERPACK_E5
ServicePlanName    : Nucleus
ProvisioningStatus : Success

UserPrincipalName  : Carol.Baker@exoip.com
DisplayName        : Carol Baker
Department         : 
UsageLocation      : NL
SkuPartNumber      : DEVELOPERPACK_E5
ServicePlanName    : MIP_S_Exchange
ProvisioningStatus : Success

UserPrincipalName  : Carol.Baker@exoip.com
DisplayName        : Carol Baker
Department         : 
UsageLocation      : NL
SkuPartNumber      : DEVELOPERPACK_E5
ServicePlanName    : MICROSOFT_COMMUNICATION_COMPLIANCE
ProvisioningStatus : Success

Export specific Microsoft 365 user details to CSV

You can also export the licenses of a specific Microsoft 365 user to a CSV file.

In our example, we will export the license information of Carol Baker to a CSV file.

C:\scripts\.\Export-Microsoft365LicenseStatus.ps1 -UserPrincipalName "Carol.Baker@exoip.com" | Export-Csv "C:\Temp\LicenseReportUser.csv"

Then you can find the CSV file in the C:\temp folder. Open the CSV file with an application like Microsoft Excel to see the results.

Export one Microsoft 365 user licenses CSV folder

Did you manage to export all Microsoft 365 user licenses? Let us know in the comments below!

Read more: Reset MFA for Microsoft 365 user »

Conclusion

You managed to get a list of all the licensed users in the Microsoft 365 admin center. But unfortunately, you only see the licenses and assigned apps when you click on a single user. A better way is to export all Microsoft 365 user licenses with the PowerShell script to get all the users and their license details in a report.

Did you enjoy this article? You may also like Enable reply all storm protection in Exchange Online. Don’t forget to follow us and share this article.

o365info Team

o365info Team

This article was written by our team of experienced IT architects, consultants, and engineers.

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *