-
Notifications
You must be signed in to change notification settings - Fork 253
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
Improve the execution performance of the azure ad provider #155
Improve the execution performance of the azure ad provider #155
Conversation
…the-azure-ad-provider' of https://github.com/cisagov/ScubaGear into 35-explore-how-to-improve-the-execution-performance-of-the-azure-ad-provider
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.
Tested performance on cisaent (45.42 sec to 35.34) y2zji (30.27 to 17.40) and scubag3forthee (5.80 to 4.86).
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.
Reviewed per test instructions on three tenants: G3 (scuba3forthee), G5 (cisaent), E5 (y2zj1). Performance improvement was best for G5.
Results are below:
cisaent main: 33.9 seconds, cisaentfeature: 20.8 seconds
y2zj1main: 12.15 seconds, y2zj1 feature: 12.3 seconds
scuba3forthee main: 3.18 seconds , scuba3forthee feature: 3.21 seconds
@schrolla Ready for merge. |
Merge testing shows that the only changes to outputs are those expected from a previous merge adding CAP policies to the HTML output. No regressions or errors found in comparison to current main branch. Merging changes. |
🗣 Description
Made adjustments to ExportAADProvider functions Get-PrivilegedUser and Get-PrivilegedRole for performance improvements. The execution speed improvements made by these code changes will be more noticeable on tenants with a larger number of privileged users (e.g. over 25) and on client machines running ScubaGear that have less resources (CPU, memory, network bandwidth) such as smaller sized virtual machines.
Closes #35.
Reduced the number of calls to Graph cmdlets that have to traverse the network and hit the back-end cloud API. The number of calls to the following cmdlets were reduced to a minimum: Get-MgUser and Get-MgRoleManagementDirectoryRoleEligibilityScheduleInstance
Added and modified comments to better describe the logic performed by each block of code.
Modified a block of code that detects when an AAD Group is assigned to a role to fix a logic error that could arise under certain circumstances.
🧪 How to Test
Test these changes on Test Tenant 1 (G5), Test Tenant 3 (E5), Test Tenant 2 (G3).
The code changes affect AAD Rego policies 2.13, 2.14, 2.15, 2.16.
Regression tests (to ensure these code updates didn't break the evaluation of the relevant Rego policies)
Expected changes between files. If you run a Diff tool between the files such as VSC code, you may notice that the main branch has some extra text "View all CA policies" in the ReportDetails field for some of the policies. This is expected because some code was added to the report generator after I rebased my branch from main. You can ignore that extra text since it is not related to the AAD functions that I modified.
Performance tests (to ensure the code enhancements produce a faster execution of the AAD provider)
Time the main branch
Import the ScubaGear module
Run the AAD provider at least one time with the authentication prompts
Execute the Powershell commands below to compute an average execution time for the main branch
Time the fix branch
Import the ScubaGear module
Run the AAD provider at least one time with the authentication prompts
Execute the Powershell commands below to compute an average execution time for the fix branch
Document the execution time results for the main and fix branches in the pull request
✅ Pre-approval checklist
in code comments.
to reflect the changes in this PR.
✅ Pre-merge checklist
✅ Post-merge checklist