The Blown Light Bulb

Information worth to share...


How to get product names with PowerShell

When managing licenses in the Azure portal or Microsoft 365 admin center, you’ll typically see product names like Office 365 E3. However, when using PowerShell cmdlets, the same product is identified by a specific name, such as ENTERPRISEPACK, or a GUID value like 6fd2c87f-b296-42f0-b197-1e91e994b900. This guide will explain how to retrieve the user-friendly names that are more commonly recognized, ideal for use in reports or notifications.

To start, you can retrieve a list of products you are licensed for by running the following PowerShell command:

Get-MgSubscribedSku -All

and this is what you get (along with some other attributes)…

SkuId                                SkuPartNumber
-----                                -------------
c5928f49-12ba-48f7-ada3-0d743a3601d5 VISIOCLIENT
1f2f344a-700d-42c9-9427-5cea1d5d7ba6 STREAM
f8a1db68-be16-40ed-86d5-cb42ce701560 POWER_BI_PRO
639dec6b-bb19-468b-871c-c5c441c4b0cb Microsoft_365_Copilot
6470687e-a428-4b7a-bef2-8a291ad947c9 WINDOWS_STORE
6fd2c87f-b296-42f0-b197-1e91e994b900 ENTERPRISEPACK
f30db892-07e9-47e9-837c-80727f46fd3d FLOW_FREE
dcb1a3ae-b33f-4487-846a-a640262fadf4 POWERAPPS_VIRAL
36a0f3b3-adb5-49ea-bf66-762134cf063a Microsoft_Teams_Premium
a403ebcc-fae0-4ca2-8c8c-7a907fd6c235 POWER_BI_STANDARD

You can see now what we were saying. We are getting the SkuId (6fd2c87f-b296-42f0-b197-1e91e994b900) and the SkuPartNumber (ENTERPRISEPACK), but what we want to see is Office 365 E3 instead. Unfortunately, the API doesn’t provide this friendly name directly. Instead Microsoft offers the Product names and service plan identifiers for licensing which includes a downloadable CSV file with all the information you need. This is what we will use.

Before proceeding, ensure you have the Microsoft Graph PowerShell SDK. Follow the provided instructions if it’s not already set up.

Use the following PowerShell script to obtain the friendly names for all the products your tenant is licensed for.

  1. Connect to Graph: First, establish a connection with Microsoft Graph.
  2. Download and Convert the CSV: The script then downloads the CSV file from Microsoft’s website and converts it into a table format.
  3. Map the SkuId to Friendly Names: Finally, for each product in your tenant, the script will match the SkuId with the friendly name and display the results.

After running the script, you’ll get a neat table with all the friendly names of the products your tenant is currently licensed for.

# Connect to Graph
Connect-MgGraph -Scopes "LicenseAssignment.Read.All"

# Initialize your friendly-names array
[array]$friendlyNamesTable =@{}

# Get subscription skus from your tenant
$licenseSkus = Get-MgSubscribedSku -All

# CSV file from Microsoft. 
# Here I'm using the Header parameter to make sure headers are set the way I want.
$header = 'Product_Display_Name','String_Id','GUID','Service_Plan_Name','Service_Plan_Id','Service_Plans_Included_Friendly_Names'
# Download the file and convert from CSV
$translationTable = Invoke-RestMethod -Method Get -Uri "https://download.microsoft.com/download/e/3/e/e3e9faf2-f28b-490a-9ada-c6089a1fc5b0/Product%20names%20and%20service%20plan%20identifiers%20for%20licensing.csv" | ConvertFrom-Csv -Header $header
# Remove the first record as it corresponds to the old headers
$translationTable = $translationTable[1..($translationTable.count - 1)]

# Foreach Sku in your tenant, get the friendly name.
foreach ($id in $licenseSkus){
    [array]$friendlyNamesTable += $translationTable | Where-Object {$_.GUID -in $id.skuId} | Select-Object Product_Display_Name, String_Id 
}

# Print the resulting list
$friendlyNamesTable | Sort-Object Product_Display_Name -Unique

Here’s an example of the output you’ll see:

Product_Display_Name                         String_Id
--------------------                         ---------
Enterprise Mobility + Security E3            EMS
Microsoft 365 E3                             SPE_E3
Microsoft 365 E5                             SPE_E5
Microsoft Copilot for Microsoft 365          Microsoft_365_Copilot
Microsoft Defender for Endpoint              WIN_DEF_ATP
Microsoft Defender for Endpoint P1           DEFENDER_ENDPOINT_P1
Microsoft Dynamics AX7 User Trial            AX7_USER_TRIAL
Microsoft Fabric (Free)                      POWER_BI_STANDARD
Microsoft Power Apps Plan 2 Trial            POWERAPPS_VIRAL
Microsoft Power Automate Free                FLOW_FREE
Microsoft Stream                             STREAM

I hope this guide helps you streamline your process!

Enjoy!