Skip to content

Commit

Permalink
Mapping product names (#1091)
Browse files Browse the repository at this point in the history
* Added product name csv file

* Added column for product names

* updated case when no product name match

* updated smoke test

* removed trailing white space

* Changed CSV file location and name

* Removed extra commas

* Smoke test correction for new table length
  • Loading branch information
dagarwal-mitre committed May 30, 2024
1 parent 74d1b5a commit a81c2b4
Show file tree
Hide file tree
Showing 3 changed files with 5,115 additions and 2 deletions.
15 changes: 15 additions & 0 deletions PowerShell/ScubaGear/Modules/CreateReport/CreateReport.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,23 @@ function New-Report {

# Handle AAD-specific reporting
if ($BaselineName -eq "aad") {

# Load the CSV file
$csvPath = Join-Path -Path $PSScriptRoot -ChildPath "MicrosoftLicenseToProductNameMappings.csv"
$csvData = Import-Csv -Path $csvPath

$LicenseInfoArray = $SettingsExport.license_information | ForEach-Object {

$SkuID = $_.SkuId
# Find the corresponding product name
$matchingRow = $csvData | Where-Object { $_.GUID -eq $SkuID } | Select-Object -First 1
$productName = "Unknown SKU Name"
if ($matchingRow) {
$productName = $matchingRow.'Product_Display_Name'
}
# Create a custom object with relevant properties
[pscustomobject]@{
"Product Name" = $productName
"License SKU Identifier" = $_.SkuPartNumber
"Licenses in Use" = $_.ConsumedUnits
"Total Licenses" = $_.PrepaidUnits.Enabled
Expand Down
Loading

0 comments on commit a81c2b4

Please sign in to comment.