M365 Licensing

In this post we will show you how to use Microsoft Graph PowerShell to view and manage Microsoft 365 Licenses. Let’s say you decided to start using M365 services.

  1. You created a new M365 Tenant & purchased required M365 product from Microsoft e.g. Microsoft 365 E3, Microsoft 365 E5 etc…
  2. Let’s verify all the purchased product by running below cmdlt.
Get-MgSubscribedSku | select SkuPartNumber,SkuId,@{N='ActiveUnits';E={$_.PrepaidUnits.enabled}}

output of above cmdlt will look like below.

3. Next lets assign license to the user. Make note of license SkuId from above list.

Set-MgUserLicense -UserId <UPN> -AddLicenses @{SkuId = <SKuId>} -RemoveLicenses @()

4. Next lets check how many license we have consumed from purchased quantity.

Get-MgSubscribedSku | select SkuPartNumber,SkuId,@{N='ActiveUnits';E={$_.PrepaidUnits.enabled}},ConsumedUnits

Output of above command will looks like as below.

Same Person Different Name !!!!!

Ok there is a bit of confusion when it comes to naming convention between Web-interface and PowerShell. It will be same product on both the places but different naming convention. Lets try to understand it with the help of example. You have purchased Office 365 E3.

GUI: Onto GUI you will see it as below, Product will show as Product name.

Let’s check the services included onto this product from entra.microsoft.com portal.

PowerShell: Onto PowerShell you will see it as below, Product will show as skupartnumber. Services will show as ServicePlans. If you see closely the service names in PowerShell differ from GUI e.g. in GUI Exchange online service name is Exchange Online (Plan 2) & in PowerShell it is Exchange_S_Enterprise

Below are the Microsoft links to download complete list of Microsoft products and their corresponding GUID in .csv format.

https://learn.microsoft.com/en-us/entra/identity/users/licensing-service-plan-reference

https://download.microsoft.com/download/e/3/e/e3e9faf2-f28b-490a-9ada-c6089a1fc5b0/Product%20names%20and%20service%20plan%20identifiers%20for%20licensing.csv

Below is the snippet from downloaded file. Yellow color reflect the product name and Green color column shows services include inside that product. One important observation onto the .csv file is string_id represent skupartnumber of PowerShell cmdlts output

You might come across scenario, where you want to assign the license but want to disable few of services inside the license e.g. in below cmdlts we are assigning a user with O365 E3, but disabling “Yammer Enterprise” and “Exchange Online”. Guid id for various licenses and servicceplans can be fetched from above .csv file. OR by running PowerShell cmdlts in your environment.

$Disabled_Service_Plan_id = @("7547a3fe-08ee-4ccb-b430-5077c5041653", "efb87545-963c-4e0d-99df-69c6916d9eb0”)
$Office365E3Sku_GUID = “6fd2c87f-b296-42f0-b197-1e91e994b900”
Set-MgUserLicense -UserId F.bautis@cloudmechanis.in -AddLicenses @{SkuId = $Office365E3Sku_GUID; DisabledPlans = $Disabled_Service_Plan_id} -RemoveLicenses @()


This entry was posted in MS Teams. Bookmark the permalink.

Leave a Reply

Your email address will not be published.