A few days ago I posted how to create a list of all licensing SKUs and their ids.
That code was something along these lines:
1 2 3 4 5 6 7 8 9 10 11 |
# From https://docs.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference $licenseCsvURL = 'https://download.microsoft.com/download/e/3/e/e3e9faf2-f28b-490a-9ada-c6089a1fc5b0/Product%20names%20and%20service%20plan%20identifiers%20for%20licensing.csv' $licenseHashTable = @{} (Invoke-WebRequest -Uri $licenseCsvURL).ToString() -replace "\?\?\?","" | ConvertFrom-Csv | ForEach-Object { $licenseHashTable[$_.Product_Display_Name] = @{ "SkuId" = $_.GUID "SkuPartNumber" = $_.String_Id "DisplayName" = $_.Product_Display_Name } } |
That creates a hash table I can lookup:
1 2 3 4 5 6 7 |
❯ $licenseHashTable.'Office 365 E3' Name Value ---- ----- SkuPartNumber ENTERPRISEPACK DisplayName Office 365 E3 SkuId 6fd2c87f-b296-42f0-b197-1e91e994b900 |
Today I wanted to do the same for service plans. And also find the SKUs associated with a service plan.
Example usage (getting the service plan Id of “Exchange Online (Plan 2)” in “Office 365 E3”:
1 2 3 4 5 |
$licenseCsvURL = 'https://download.microsoft.com/download/e/3/e/e3e9faf2-f28b-490a-9ada-c6089a1fc5b0/Product%20names%20and%20service%20plan%20identifiers%20for%20licensing.csv' $exchangePlan = (Invoke-WebRequest -Uri $licenseCsvURL).ToString() -replace "\?\?\?","" | ConvertFrom-Csv | Where-Object{ $_.Product_Display_Name -eq "Office 365 E3" -and $_.Service_Plans_Included_Friendly_Names -eq "Exchange Online (Plan 2)" } $exchangeId = $exchangePlan.Service_Plan_Id |
1 2 3 4 5 6 7 8 9 10 11 12 |
$planHashTable = @{} (Invoke-WebRequest -Uri $licenseCsvURL).ToString() -replace "\?\?\?","" | ConvertFrom-Csv | ForEach-Object { $planHashTable[$_.Service_Plans_Included_Friendly_Names] = @{ "PlanId" = $_.Service_Plan_Id "DisplayName" = $_.Service_Plans_Included_Friendly_Names "Skus" = if ($planHashTable[$_.Service_Plans_Included_Friendly_Names].Skus.Length -eq 0 ) { @($_.Product_Display_Name) } else { @($planHashTable[$_.Service_Plans_Included_Friendly_Names].Skus) + @($_.Product_Display_Name) } } } |
Now I can do the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
❯ $planHashTable.'EXCHANGE ONLINE (PLAN 2)' Name Value ---- ----- Skus {EXCHANGE ONLINE (PLAN 2), Microsoft 365 A3 for Faculty, MICROSOFT 365 A3 FOR STUDENTS, Microsoft 365 A3 for students use benefit…} PlanId efb87545-963c-4e0d-99df-69c6916d9eb0 DisplayName EXCHANGE ONLINE (PLAN 2) ❯ $planHashTable.'OFFICE 365 BUSINESS' Name Value ---- ----- Skus {MICROSOFT 365 APPS FOR BUSINESS, MICROSOFT 365 APPS FOR BUSINESS, MICROSOFT 365 BUSINESS STANDARD - PREPAID LEGACY} PlanId 094e7854-93fc-4d55-b2c0-3ab5369ebdc1 DisplayName OFFICE 365 BUSINESS |
The Skus
key is an array.
Update (17th Sept 2024): The code was updated to add -replace"\?\?\?",""
because it looks like the Product_Display_Name
column appears as ???Product_Display_Name
in the downloaded file.