Summary: PowerShell Commands to determine the Office 365 Licenses that have been assigned to users. Connect to Exchange Online (EXO)
Also Read: Powershell – Applying Licenses to list of users on Office 365
$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
Connect to Azure Active Directory (Azure AD)
connect-msolservice
List the SKUs (Stock keeping units) that the company Owns using Get-MsolAccountSku
Get-MsolAccountSku
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
References: Product names and service plan identifiers for licensing