Add Entitlement Management tests MT.1107-MT.1111#1381
Add Entitlement Management tests MT.1107-MT.1111#1381merill merged 11 commits intomaester365:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds 5 new Maester Core Tests (MT.1107-MT.1111) for Microsoft Entra ID Identity Governance Entitlement Management. These tests validate the configuration and integrity of access packages, catalogs, policies, and resources in Entra ID Governance.
Changes:
- Adds 5 new PowerShell test functions for entitlement management validation
- Adds corresponding Pester test wrappers with appropriate tags
- Adds documentation files for each test with descriptions, remediation steps, and related links
- Updates module manifest to export the new test functions
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| powershell/Maester.psd1 | Adds 5 new test functions to the module exports |
| powershell/public/maester/entra/Test-MtEntitlementManagementDeletedGroups.ps1 | Validates that access packages and catalogs don't reference deleted groups |
| powershell/public/maester/entra/Test-MtEntitlementManagementDeletedGroups.md | Documentation for deleted groups test |
| powershell/public/maester/entra/Test-MtEntitlementManagementInactivePolicies.ps1 | Checks for inactive or misconfigured assignment policies |
| powershell/public/maester/entra/Test-MtEntitlementManagementInactivePolicies.md | Documentation for inactive policies test |
| powershell/public/maester/entra/Test-MtEntitlementManagementOrphanedResources.ps1 | Identifies catalog resources not used in any access package |
| powershell/public/maester/entra/Test-MtEntitlementManagementOrphanedResources.md | Documentation for orphaned resources test |
| powershell/public/maester/entra/Test-MtEntitlementManagementValidApprovers.ps1 | Validates approval workflows have valid, active approvers |
| powershell/public/maester/entra/Test-MtEntitlementManagementValidApprovers.md | Documentation for valid approvers test |
| powershell/public/maester/entra/Test-MtEntitlementManagementValidResourceRoles.ps1 | Checks catalog resources for stale app roles and deleted service principals |
| powershell/public/maester/entra/Test-MtEntitlementManagementValidResourceRoles.md | Documentation for valid resource roles test |
| tests/Maester/Entra/Test-MtEntitlementManagementDeletedGroups.Tests.ps1 | Pester test wrapper for MT.1107 |
| tests/Maester/Entra/Test-MtEntitlementManagementInactivePolicies.Tests.ps1 | Pester test wrapper for MT.1108 |
| tests/Maester/Entra/Test-MtEntitlementManagementOrphanedResources.Tests.ps1 | Pester test wrapper for MT.1110 |
| tests/Maester/Entra/Test-MtEntitlementManagementValidApprovers.Tests.ps1 | Pester test wrapper for MT.1109 |
| tests/Maester/Entra/Test-MtEntitlementManagementValidResourceRoles.Tests.ps1 | Pester test wrapper for MT.1111 |
| website/docs/tests/maester/MT.1107.md | User-facing documentation for deleted groups test |
| website/docs/tests/maester/MT.1108.md | User-facing documentation for inactive policies test |
| website/docs/tests/maester/MT.1109.md | User-facing documentation for valid approvers test |
| website/docs/tests/maester/MT.1110.md | User-facing documentation for orphaned resources test |
| website/docs/tests/maester/MT.1111.md | User-facing documentation for valid resource roles test |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
powershell/public/maester/entra/Test-MtEntitlementManagementValidResourceRoles.ps1
Outdated
Show resolved
Hide resolved
powershell/public/maester/entra/Test-MtEntitlementManagementOrphanedResources.ps1
Outdated
Show resolved
Hide resolved
powershell/public/maester/entra/Test-MtEntitlementManagementDeletedGroups.ps1
Outdated
Show resolved
Hide resolved
powershell/public/maester/entra/Test-MtEntitlementManagementValidResourceRoles.ps1
Show resolved
Hide resolved
powershell/public/maester/entra/Test-MtEntitlementManagementInactivePolicies.ps1
Outdated
Show resolved
Hide resolved
powershell/public/maester/entra/Test-MtEntitlementManagementValidResourceRoles.ps1
Outdated
Show resolved
Hide resolved
|
@nicowyss, these are great checks! Do you have any thoughts on the suggestions from the Copilot review? I haven't had a chance to review much lately, but this might give you a few things to test. Thanks! |
- Add missing elseif branch for single object responses in: - Test-MtEntitlementManagementValidResourceRoles (allPackages, roleScopes) - Test-MtEntitlementManagementValidApprovers (members) - Fix Write-Error to use $_.Exception.Message instead of $_ in all 4 files
- Move Graph API call for access packages before catalog foreach loop - Reduces API calls from N (per catalog) to 1 - Apply to both OrphanedResources and ValidResourceRoles tests
Just to be clear: you don't have to automatically accept all Copilot suggestions! It's just the best I can offer with my current schedule. |
@SamErde Yes, of course, I'm currently working my way through the review comments, and many of them make a lot of sense. |
- Updated line 121 to use the consistent 3-branch pattern for handling Graph API responses (Array, .value property, single object) - Ensures paginated results with .value property are handled correctly
|
This is looking good! FYI, the build validation tests produced the following items to resolve: PSUseBOMForUnicodeEncodedFileThe following files are missing a BOM for UTF-8 encoding, which can cause issues when the file is opened in certain editors or environments.
To fix $AffectedFilePath = 'powershell/public/maester/entra/Test-MtTenantCreationRestricted.ps1'
$Content = Get-Content $AffectedFilePath -Raw; $Content | Out-File $AffectedFilePath -Encoding UTF8BOMPSUseDeclaredVarsMoreThanAssignmentsThe following files have variables that are declared but not used anywhere in the code, which can lead to confusion and maintenance issues.
PSUseSingularNounsThe following files contain functions that do not follow the recommended naming convention of using singular nouns, which can lead to confusion and inconsistency in the codebase.
HasValidLinkSectionThe following functions have links in their documentation that do not point to the expected location. Links in this section should point to the command documentation at Block : Function Test-MtEntitlementManagementDeletedGroups Block : Function Test-MtEntitlementManagementInactivePolicies Block : Function Test-MtEntitlementManagementOrphanedResources Block : Function Test-MtEntitlementManagementValidApprovers Block : Function Test-MtEntitlementManagementValidResourceRoles These tests run automatically on PRs but you can also run them yourself locally! In your fork of the project, run |
|
@SamErde Thanks for your patience, I run the tests locally and fixed the warnings/errors. |
SamErde
left a comment
There was a problem hiding this comment.
Looking and working great! I don't cover every pass/fail scenario in my tenant yet, but my testing so far returns accurate results. I think this only needs 2 things before merging:
- Please remove the 'Security' tag from the test script tags. We have been moving away from using any tag that applies to every (or almost every) test.
- Add these test titles and their Severity ratings to
tests\maester-config.json. They are not listed yet, so the final report shows no severity ratings for these new tests.
Thank you! 🙏
|
@SamErde Although I claimed my numbers according to the procedure, see: “#️⃣ Pick next Maester test sequence number #697” |
Ah, sorry to see that! Looks like innocent human error. You can take MT.1106 to replace MT.1111. |
|
Awesome work @nicowyss I believe these are the first ones around ID Governance in Maester. Thanks so much!! |
I would like to post something about thoose tests. |
Summary
Adds 5 new Maester Core Tests for Entra ID Identity Governance Access Packages.
Tests Added
Notes