Pre-submission checklist
Note: this is distinct from #1733 (which is the no-P2-license variant of the same symptom). This issue is specifically about the missing scope, reproducible on a tenant that does have Entra ID P2.
Describe the bug
Connect-Maester builds its Graph scope list from Get-MtGraphScope, which does not include EntitlementManagement.Read.All. As a result, the five access-package / catalog hygiene tests added in #1381 always fail at runtime on tenants with Entra ID P2:
- MT.1106 β
Test-MtEntitlementManagementValidResourceRoles
- MT.1107 β
Test-MtEntitlementManagementDeletedGroups
- MT.1108 β
Test-MtEntitlementManagementInactivePolicies
- MT.1109 β
Test-MtEntitlementManagementValidApprovers
- MT.1110 β
Test-MtEntitlementManagementOrphanedResources
All five surface as:
Error running test: Response status code does not indicate success: Forbidden (Forbidden).
Unlike #1733, this is not the NoLicense variant β the tenant meets the license requirement (Get-MtLicenseInformation -Product EntraID returns P2). The 403 is caused by the missing scope; adding EntitlementManagement.Read.All to the scope set resolves all five tests.
Note on reproduction: Entra user-level consent is sticky for the Microsoft Graph Command Line Tools app β once a user has consented EntitlementManagement.Read.All to that app (for any reason, in any session), subsequent Connect-Maester calls receive an access token that already covers the scope, so the bug appears to "self-heal" and won't reproduce without revoking and re-consenting the app. This may explain why the issue isn't more widely reported. A clean repro requires either a freshly-consented account or revoking consent for the MS Graph CLI enterprise app first.
Steps to reproduce
- On a tenant with Entra ID P2 (confirmed via
Get-MtLicenseInformation -Product EntraID returning P2):
Connect-Maester (default scopes)
Invoke-Maester
- Observe MT.1106β1110 all error with Forbidden.
- Inspect the granted scopes β
(Get-MgContext).Scopes does not contain EntitlementManagement.Read.All.
Expected behaviour
Connect-Maester should request EntitlementManagement.Read.All as part of the default read-only scope list, since five shipped tests depend on it. The tests should then run and produce real pass/fail results on P2 tenants.
Workaround
Disconnect-MgGraph
Connect-MgGraph -Scopes ((Get-MtGraphScope) + 'EntitlementManagement.Read.All')
Invoke-Maester
After re-consent the five tests run normally.
Proposed fix
Add 'EntitlementManagement.Read.All' to the default read-only scope list in powershell/public/Get-MtGraphScope.ps1 (alphabetised between Directory.Read.All and IdentityRiskEvent.Read.All). Also update website/docs/sections/permissions.md for parity, per the comment in that file.
Happy to send the PR if helpful β it's a one-line change plus the doc entry.
Module version
Environment data
PSVersion: 7.5.4
PSEdition: Core
Platform: Unix (macOS Darwin 25.5.0)
Microsoft.Graph.Authentication: 2.36.1
Additional context
EntitlementManagement.Read.All is the canonical scope for reading entitlement-management resources per the Graph permissions reference: https://learn.microsoft.com/en-us/graph/api/resources/entitlementmanagement-overview#authorization
The tests were added in #1381 (merged 2025-12-15) but the scope list in Get-MtGraphScope.ps1 wasn't updated alongside.
Pre-submission checklist
Describe the bug
Connect-Maesterbuilds its Graph scope list fromGet-MtGraphScope, which does not includeEntitlementManagement.Read.All. As a result, the five access-package / catalog hygiene tests added in #1381 always fail at runtime on tenants with Entra ID P2:Test-MtEntitlementManagementValidResourceRolesTest-MtEntitlementManagementDeletedGroupsTest-MtEntitlementManagementInactivePoliciesTest-MtEntitlementManagementValidApproversTest-MtEntitlementManagementOrphanedResourcesAll five surface as:
Unlike #1733, this is not the
NoLicensevariant β the tenant meets the license requirement (Get-MtLicenseInformation -Product EntraIDreturnsP2). The 403 is caused by the missing scope; addingEntitlementManagement.Read.Allto the scope set resolves all five tests.Note on reproduction: Entra user-level consent is sticky for the Microsoft Graph Command Line Tools app β once a user has consented
EntitlementManagement.Read.Allto that app (for any reason, in any session), subsequentConnect-Maestercalls receive an access token that already covers the scope, so the bug appears to "self-heal" and won't reproduce without revoking and re-consenting the app. This may explain why the issue isn't more widely reported. A clean repro requires either a freshly-consented account or revoking consent for the MS Graph CLI enterprise app first.Steps to reproduce
Get-MtLicenseInformation -Product EntraIDreturningP2):Connect-Maester(default scopes)Invoke-Maester(Get-MgContext).Scopesdoes not containEntitlementManagement.Read.All.Expected behaviour
Connect-Maestershould requestEntitlementManagement.Read.Allas part of the default read-only scope list, since five shipped tests depend on it. The tests should then run and produce real pass/fail results on P2 tenants.Workaround
After re-consent the five tests run normally.
Proposed fix
Add
'EntitlementManagement.Read.All'to the default read-only scope list inpowershell/public/Get-MtGraphScope.ps1(alphabetised betweenDirectory.Read.AllandIdentityRiskEvent.Read.All). Also updatewebsite/docs/sections/permissions.mdfor parity, per the comment in that file.Happy to send the PR if helpful β it's a one-line change plus the doc entry.
Module version
Environment data
Additional context
EntitlementManagement.Read.Allis the canonical scope for reading entitlement-management resources per the Graph permissions reference: https://learn.microsoft.com/en-us/graph/api/resources/entitlementmanagement-overview#authorizationThe tests were added in #1381 (merged 2025-12-15) but the scope list in
Get-MtGraphScope.ps1wasn't updated alongside.