Export Licenses assigned to users from Microsoft 365

In this blog post, we will see how to Export the list of users and assigned licenses from Microsoft 365 using Powershell. We will be using get-msoluser cmdlet for this. Let’s check the steps.

  1. Connect to Exchange Online Powershell.
$mycred = Get-Credential <Global Administrator User ID> 
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $mycred -Authentication Basic -AllowRedirection 
Import-PSSession $Session
  1. Connect to Entra ID.
connect-msolservice
  1. List the SKUs (Stock keeping units) that the company Owns using Get-MsolAccountSku
Get-MsolAccountSku
  1. Export the Users with Licenses assigned to them to a CSV file.
Get-msoluser | ft UserPrincipalName, @{L='Licenses Assigned'; E={($_.licenses).Accountskuid}} | Out-File c:\temp\LicenseExport.csv

To find the Product names and service plan identifiers for licensing. Please visit below Microsoft link for Licensing service plan reference.

https://docs.microsoft.com/en-us/azure/active-directory/users-groups-roles/licensing-service-plan-reference

Leave a Comment

Discover more from TechPress

Subscribe now to keep reading and get access to the full archive.

Continue reading