Repository navigation
Description
Six CISA controls read PIM endpoints directly once the tenant appears to have Entra ID P2 or Governance:
| Control | Function | Endpoint |
|---|---|---|
| CISA.MS.AAD.7.4 | Test-MtCisaPermanentRoleAssignment |
roleManagement/directory/roleAssignmentSchedules |
| CISA.MS.AAD.7.5 | Test-MtCisaUnmanagedRoleAssignment |
roleManagement/directory/roleAssignmentSchedules |
| CISA.MS.AAD.7.6 | Test-MtCisaRequireActivationApproval |
policies/roleManagementPolicyAssignments |
| CISA.MS.AAD.7.7 | Test-MtCisaAssignmentNotification |
policies/roleManagementPolicyAssignments |
| CISA.MS.AAD.7.8, 7.9 | Test-MtCisaActivationNotification |
policies/roleManagementPolicyAssignments |
#2255 showed that subscribedSkus can list a P2 plan while the PIM API still rejects the tenant with 400 AadPremiumLicenseRequired. In a tenant without P2, both endpoints above return that error. #2260 handled it in Get-MtRoleMember, but these functions call the endpoints themselves.
What happens in 2.3.0, measured with the Graph SDK against a local server that returns this 400:
- Run under Pester, as
Invoke-Maesterdoes, the five functions fail with the Graph error instead of being skipped. - Called directly from a script, the error is printed and the function still returns a verdict:
$truefor the two role-assignment checks (7.4, 7.5) and$falsefor the three policy checks.
The 3.0 rewrite in #2334 keeps the same calls with no handling for this error, and its License gate reads the same subscribedSkus service plans.
Suggested fix: on AadPremiumLicenseRequired, skip with NotLicensedEntraIDP2OrGovernance, the reason these tests already use when the license check finds no P2. Other errors would still be thrown.
I have this fix with tests for the current layout and am happy to open a PR if you'd like one. Because of the contribution pause, I plan to wait until 3.0 is on main and then target the native test files.
Activity
JeremyFinney-lgtm commentedon Nov 10, 2026
Implemented and pushed in #2756, commit
6e6d1b1d7.All six PIM checks, CISA.MS.AAD.7.4–7.9, now stop and skip with
NotLicensedEntraIDP2OrGovernancewhen the PIM API specifically returnsAadPremiumLicenseRequired, even if subscribed service plans report a qualifying licence. Other API errors are rethrown, not classified as licence skips.The fix does not fall back to incomplete non-PIM data or change the SCuBA compliance conditions. A licence rejection produces no compliance verdict, and session caching remains intact.
Regression coverage includes all six checks: licence skips, terminating-error handling, permission/server errors, unchanged compliant/noncompliant verdicts, and native-engine Skipped versus Error outcomes. The targeted Pester selection passed 137 tests, with 92 additional analyzer/retired-check validations passing.
Pending review and merge; no live-tenant validation performed.