Skip to content
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

Add Licensing Information to AAD Report #954

Closed
wants to merge 25 commits into from

Conversation

dagarwal-mitre
Copy link
Collaborator

@dagarwal-mitre dagarwal-mitre commented Mar 1, 2024

🗣 Description

This PR concludes adding licensing information to ScubaGear.

💭 Motivation and context

The licensing information has been added to the bottom part of the AAD report for users to be able to review. This will conclude the larger epic for adding licensing information to ScubaGear (#466)

Closes #778

🧪 Testing

This was tested using the different tenants and checking to make sure that the report will still generate without issues even if the AAD report isn't run.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • PR targets the correct parent branch (e.g., main or release-name) for merge.
  • Changes are limited to a single goal - eschew scope creep!
  • Changes are sized such that they do not touch excessive number of files.
  • All future TODOs are captured in issues, which are referenced in code comments.
  • These code changes follow the ScubaGear content style guide.
  • Related issues these changes resolve are linked preferably via closing keywords.
  • All relevant type-of-change labels added.
  • All relevant project fields are set.
  • All relevant repo and/or project documentation updated to reflect these changes.
  • Unit tests added/updated to cover PowerShell and Rego changes.
  • Functional tests added/updated to cover PowerShell and Rego changes.
  • All relevant functional tests passed.
  • All automated checks (e.g., linting, static analysis, unit/smoke tests) passed.

✅ 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

  • Feature branch deleted after merge to clean up repository.
  • Verified that all checks pass on parent branch (e.g., main or release-name) after merge.

@dagarwal-mitre dagarwal-mitre added the enhancement This issue or pull request will add new or improve existing functionality label Mar 1, 2024
@dagarwal-mitre dagarwal-mitre added this to the Glacier milestone Mar 1, 2024
@dagarwal-mitre dagarwal-mitre self-assigned this Mar 1, 2024
@dagarwal-mitre dagarwal-mitre force-pushed the 778-add-licensing-information-to-html branch from cc792cc to 2553aeb Compare March 4, 2024 19:41
Copy link
Collaborator

@gdasher gdasher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to these 2 minor comments, can you also:

  1. Update the stub in the unit test (c.f. New-Report.Tests.ps1) to populate SKU related info so that these code paths get minimally tested for not crashing?

  2. Make sure the smoke test (esp. SmokeTest002.Tests.ps1) still passes and update it to ensure that the existence of the license table is checked?

Copy link
Collaborator

@mitchelbaker-cisa mitchelbaker-cisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something to capture as either a future todo or if you think it falls within the scope of this PR -- the colorRows() function in main.js assumes tables have a size of 3, resulting in an out of bounds error with the license table. Should be a tiny fix either way.

Screenshot (36)

Screenshot (35)

@gdasher
Copy link
Collaborator

gdasher commented Mar 5, 2024

Something to capture as either a future todo or if you think it falls within the scope of this PR -- the colorRows() function in main.js assumes tables have a size of 3, resulting in an out of bounds error with the license table. Should be a tiny fix either way.

Good flag. I would like us to fix this so we don't ship JS errors.

crutchfield and others added 2 commits March 6, 2024 10:21
* Break setup dependency

* debug

* Remove MockWith

* WIP

* Use module name on invoke

* debug

* debug

* debug

* debug

* debug

* wip

* wip

* wip

* wip

* Mock IMport-Module

* WIP

* wip

* WIP

* Mock OPA Cmd

* Rework ScubaConfig test due to rebase

* Address warnings in UT
* Update dependencies

* Add init for scuba

* Remove SkipUpdate

* Relpace OPA.ps1

* Call Initialize-SCuBA

* Update README

* Update PowerShell/ScubaGear/Dependencies.ps1

Co-authored-by: David Bui <105074908+buidav@users.noreply.github.com>

* Update README.md

Co-authored-by: Addam Schroll <108814318+schrolla@users.noreply.github.com>

* Update readme

* Update README.md

Co-authored-by: David Bui <105074908+buidav@users.noreply.github.com>

---------

Co-authored-by: David Bui <105074908+buidav@users.noreply.github.com>
Co-authored-by: Addam Schroll <108814318+schrolla@users.noreply.github.com>
Copy link
Collaborator

@schrolla schrolla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding feedback based on running and reviewing the results of the report. Overall, looks good and no errors. I did provide feedback on possible grammatical changes and added capability, possibly as future TODO.

@tkol2022
Copy link
Collaborator

tkol2022 commented Mar 6, 2024

@dagarwal-mitre Just letting you know that I tested this as well and it worked fine for me. Nice work!

I'd like you to change the title of the new table from "Licensing Information" to "Tenant Licensing Information".

* Re-pin Graph to latest major/minor version

* Re-pin Graph to latest major/minor version

* Fix UT
Copy link
Collaborator

@tkol2022 tkol2022 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Cmdlet Get-MgBetaSubscribedSku is being called twice in the AAD provider resulting in two calls to the REST API. Please modify the code so that it is only called once. Once the REST API is called, you can save the API results to a new local variable and then still perform the local filtering with Where-Object and Select-Object against the new local variable.

image
image

Also move the LicenseInfo variable further up into the code so that it is right after the line containing the ServicePlans variable. This way all licensing related code is grouped in the same block.

james-garriss and others added 6 commits March 7, 2024 09:58
* make consistent names and add if condition

* update filenames in pipeline

* fix filename in pipeline

* change workflow names

* update names
* Adjust path for required versions

* Use Split-Path

* throw exception if RequiredVersions not found

* throw exception if RequiredVersions not found

* add try catch
* rebasing

* finish rebase

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* add key

* fix alias

* fix thumbprint name

* debug

* debug

* debug

* debug

* debug

* fix typo

* debug

* check path location

* Remove psd1 file

* fix path

* Remove comments

* keep 1 file

* stop using dev params
* Tweak comments

* Create Merge-JsonOutput function

* Undo pds1 file modification

* Correct config bug for OutJsonFileName

* Mock Merge-JsonOutput function in the RunCached test

* Modify pester tests

* Remove trailing whitespace

* Tweak comments

* Create Merge-JsonOutput function

* Undo pds1 file modification

* Correct config bug for OutJsonFileName

* Mock Merge-JsonOutput function in the RunCached test

* Modify pester tests

* Update PowerShell/ScubaGear/Testing/Unit/PowerShell/Orchestrator/Invoke-RunCached.Tests.ps1

Co-authored-by: Richard Crutchfield <crutchfield@users.noreply.github.com>

* Add switch for MergeJson

* Update README.md with MergeJson

* Change keys to "Tool" and "ToolVersion"

Co-authored-by: David Bui <105074908+buidav@users.noreply.github.com>

---------

Co-authored-by: Richard Crutchfield <crutchfield@users.noreply.github.com>
Co-authored-by: David Bui <105074908+buidav@users.noreply.github.com>
crutchfield and others added 3 commits March 12, 2024 12:44
* Update regal version

* debug

* import rego.v1

* remove if {}

* replace boolean asignments

* Up regal setup version

* Fix review issues

* Add default OPA version
@dagarwal-mitre
Copy link
Collaborator Author

The Cmdlet Get-MgBetaSubscribedSku is being called twice in the AAD provider resulting in two calls to the REST API. Please modify the code so that it is only called once. Once the REST API is called, you can save the API results to a new local variable and then still perform the local filtering with Where-Object and Select-Object against the new local variable.

image image

Also move the LicenseInfo variable further up into the code so that it is right after the line containing the ServicePlans variable. This way all licensing related code is grouped in the same block.

I have updated this to utilize a variable rather than calling the same cmdlet multiple times and grouped the code together now. Please take a look at it when you get a chance.

@dagarwal-mitre
Copy link
Collaborator Author

@dagarwal-mitre Just letting you know that I tested this as well and it worked fine for me. Nice work!

I'd like you to change the title of the new table from "Licensing Information" to "Tenant Licensing Information".

Updated.

@tkol2022
Copy link
Collaborator

@dagarwal-mitre @nanda-katikaneni FYI - I'd like to ensure that this PR works on the G3 tenant before merging. In particular we need to ensure that the license message for policies not available in G3 tenants shows up in the report since we have changed the foundational code for handling the G3 license.

Also I'd like to run the functional test orchestrator against the G3.

@tkol2022
Copy link
Collaborator

tkol2022 commented Mar 13, 2024

Screenshots of the new capability

This is just to show what the new reporting feature looks like across four different tenants. The G3 tenant is in a suspended license state and this is why the total licenses shows zero.

image

image

image

image

@tkol2022
Copy link
Collaborator

Testing update

Tested the most recent code updates where Devesh grouped processing of the licenses into the same code block against the G5, GCC High and E5 tenants. The code did not break any existing functionality that relies on the AAD license info. Once the G3 tenant is backup up we need to test there to ensure that the licensing report works with G3 and do a regression to ensure the existing Rego policies that check for the AAD premium license still work since the related provider code was modified.

Copy link
Collaborator

@schrolla schrolla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Results of the current PR are consistent with the direction the group has decided on for licensing information. All of my comments have been addressed and the TODO issue has been filed. Looks good to me.

@schrolla
Copy link
Collaborator

Setting status to blocked until the G3 test tenant expired license is resolved so this PR can be tested against that level prior to merge.

@schrolla
Copy link
Collaborator

Work here moved to new PR #1011 to better handle branch conflicts. Closing.

@schrolla schrolla closed this Mar 21, 2024
@schrolla schrolla removed this from the Glacier milestone Mar 21, 2024
@schrolla schrolla deleted the 778-add-licensing-information-to-html branch March 21, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue or pull request will add new or improve existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Licensing Information to HTML Report
8 participants