Home » Microsoft 365 » Get-MgUserLicenseDetail – View Licensed Details of a User

Get-MgUserLicenseDetail – View Licensed Details of a User

The Get-MgUserLicenseDetail cmdlet in PowerShell gets the license details of the specified user. It is read-only.

To use the Get-MgUserLicenseDetail cmdlet, you must first connect to your Microsoft 365 tenant using the Connect-MGraph cmdlet. Once you are connected, you can use the Get-MgUserLicenseDetail cmdlet to get the collection of licenses assigned to the user.

Connect-MgGraph -Scopes 'User.Read.All'

The syntax to get the license details of the user is given below.

Get-MgUserLicenseDetail
   -UserId <String>
   -LicenseDetailsId <String>
   [-ExpandProperty <String[]>]
   [-Property <String[]>]
   [-Filter <String>]
   [-Search <String>]
   [-Skip <Int32>]
   [-Sort <String[]>]
   [-Top <Int32>]
   [-PageSize <Int32>]
   [-All]
   [-CountVariable <String>]
   [<CommonParameters>]

In this article, we will discuss how to use the Get-MgUserLicenseDetail cmdlet in PowerShell to get the license details for the user.

How to Get the User’s License Details

To get the user’s license details, run the following command.

 Get-MgUserLicenseDetail -UserId 'cf634aac-d7d1-41a4-aad9-544c0bfda070' 

The Get-MgUserLicenseDetail cmdlet in PowerShell uses the -UserId parameter to specify the user to retrieve the collection of the license assigned to him.

Get User License Details
Get User License Details

The output of the Get-MgUserLicenseDetail command includes the following properties.

  • Id: The unique identifier of license details
  • SkuId: The Sku Id
  • SkuPartNumber: The Sku part number.

Conclusion

I hope the above article on how to use the Get-MgUserLicenseDetail cmdlet in PowerShell to get the user’s license details is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Related Links

Get-MgUserDirectReport