-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mapping product names #1091
base: main
Are you sure you want to change the base?
Mapping product names #1091
Conversation
I am unsure where to put the product names csv file, currently it is in the ScubaGear folder, if it needs to be moved to a different location please reply to this comment. |
$SkuID = $_.SkuId | ||
# Find the corresponding product name | ||
$matchingRow = $csvData | Where-Object { $_.GUID -eq $SkuID } | Select-Object -First 1 | ||
$productName = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the case where we fail to find a match (e.g. a new SKU), lets use some language here instead of just blank. "Unknown SKU Name"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
$matchingRow = $csvData | Where-Object { $_.GUID -eq $SkuID } | Select-Object -First 1 | ||
$productName = "" | ||
if ($matchingRow) { | ||
$productName = $matchingRow.'Product_Display_Name' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgive my powershell ignorance, but does this properly select from the matching row object?
Would it be better to use camelCase headers in the CSV or is the CSF just a direct import from Microsoft's website?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line will select from the matching row based on the SKU ID, but since it is using a direct import from microsoft's website I didn't do camel casing, in order to make it easier for future updates to directly import the csv rather than making changes to it. Currently the CSV file had a few columns removed which were unused, since the file original size was nearly 1MB and now it is closer to 450 kb. The goal was to make sure speed wasn't impacted, so I made the table size smaller.
[pscustomobject]@{ | ||
"Product Name" = $productName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the product names are quite long. Can you take a screenshot to show how the table looks now so we can see if it will look ok in practice, at least for commonly used SKUs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -210,8 +210,22 @@ function New-Report { | |||
|
|||
# Handle AAD-specific reporting | |||
if ($BaselineName -eq "aad") { | |||
|
|||
# Load the CSV file | |||
$csvData = Import-Csv -Path "Product Names for Licensing.csv" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we update the unit test for this case (e.g. by mocking out Import-Csv to avoid loading the file)? I think we added a decent test for this table IIRC.
Given the direct copy is used, we can likely generalize David Bui's github action to check for updates to this file as well Probably just be comparing hashes for changes and updating if so, for example? Suggest we file an issue for that after this is committed. Separately, please ping when the test cases have been updated and I will re-review for approval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See notes about recommendations for CSV file suggestions.
Product Names for Licensing.csv
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should not be present in the top-level folder. Doing so means it would not be distributed in the PowerShell gallery package since it doesn't exist in the actual module. Recommend moving the file into the PowerShell/ScubaGear/Modules/CreateReport folder since that is the scope in which it is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Product Names for Licensing.csv
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend renaming the file to remove all spaces from the filename and renaming to something more specific such as "MicrosoftLicenseToProductNameMappings.csv". This helps users better understand what the file is and why it exists and removing spaces makes it less likely there will be an error processing the file in code in case someone forgets to enclose the space filled name in quotes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Product Names for Licensing.csv
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file has headers for 3 fields, but all fields include an unnamed and empty fourth field (shown by the double commas on the end of each row). Is there a reason for the fourth field? If so, it should have a name in the header. If not, the extra comma at the end of every line should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra commas have been removed
[pscustomobject]@{ | ||
"Product Name" = $productName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗣 Description
Added product names to the table with with tenant licensing information
Closes #993
💭 Motivation and context
This helps users understand which licenses they have
🧪 Testing
Tested with the different tenants
✅ Pre-approval checklist
✅ Pre-merge checklist
PR passed smoke test check.
Feature branch has been rebased against changes from parent branch, as needed
Use
Rebase branch
button below or use this reference to rebase from the command line.Resolved all merge conflicts on branch
Notified merge coordinator that PR is ready for merge via comment mention
✅ Post-merge checklist