SharePointVault ~/gotchas/graph ⌕ Search 459 pages, error messages, scripts…Ctrl K ★ Star
M↓ README.mdM↓ pim-graph-without-p2-returns-400-aadpremiumlicenserequired.md
sharepoint-vault›gotchas›graph›pim-graph-without-p2-returns-400-aadpremiumlicenserequired.mdhistoryedit on GitHub
● GOTCHAgraph· 2 min read

PIM via Graph on a tenant without Entra ID P2

applies to: Microsoft Graph v1.0, Microsoft Entra IDreviewed: 2026-11-29#graph#pim#entra-id#licensing#error-handling

If your app reads Privileged Identity Management data, expect 400 with code AadPremiumLicenseRequired on tenants without a PIM license (Entra ID P2 or Entra ID Governance) – even after the admin consented to the read scopes. It is not 403, so code that maps "4xx = no permission" shows the wrong message. Treat it as "this tenant has no PIM" and show that as a state.

Bez licence pro PIM (Entra ID P2 nebo Entra ID Governance) vrací PIM endpointy v Graphu 400 AadPremiumLicenseRequired, ne 403 – i se schválenými scopy. Čti to jako „tenant PIM nemá“, ne jako chybu čtení nebo chybějící souhlas.

What was measured

Delegated Microsoft Graph from an SPFx app, signed in as a global admin on a tenant without Entra ID P2 (November 2026). The token scp claim contained RoleManagement.Read.Directory, RoleEligibilitySchedule.Read.Directory and RoleManagementPolicy.Read.Directory.

Request Result
GET /roleManagement/directory/roleAssignments?$top=1 200 – permanent role assignments are readable without P2
GET /roleManagement/directory/roleEligibilitySchedules?$top=1 400 AadPremiumLicenseRequired
GET /policies/roleManagementPolicies?$filter=scopeId eq '/' and scopeType eq 'Directory' 400 AadPremiumLicenseRequired

What it means for an app

  • Classify by the error code, not only the status: AadPremiumLicenseRequired → "PIM not available on this tenant (needs Entra ID P2 or Entra ID Governance)"; 403 / Authorization_RequestDenied → missing consent or role.
  • Consent alone tells you nothing about licensing: the scopes can be granted and visible in the token while the endpoints still refuse.
  • Cover the classification with a unit test that uses the real error body – a tenant with P2 will never take this path, and one without P2 will never take the other.

Sources

Not measured

  • The exact response on a tenant with P2 but no PIM role configured.
  • Whether roleAssignmentSchedules behaves like roleEligibilitySchedules.
Was this helpful?ask or add your experience on GitHub →
Saved you an hour? A star on GitHub helps other SharePoint people find the vault.★ Star on GitHub
last reviewed: 2026-11-29last updated: 2026-11-29historyedit on GitHubview source