Query Microsoft Graph across multiple tenants from PowerShell — auth, retries, throttling, and paging handled for you.
GraphKit is an app-only, multi-tenant Microsoft Graph execution and analysis layer for PowerShell, with explicit Microsoft Intune and Entra operation semantics.
It centralizes tenant profiles, credential resolution, token acquisition, Graph request execution, paging, batching, throttling, retry policy, permission analysis, and evidence export without becoming a generic Graph SDK or OAuth client.
- Immutable, tenant-specific execution contexts
- Certificate, client-secret, managed-identity, and vault-resolved bearer-token authentication
- MSAL.NET for token acquisition
- A GraphKit-owned
HttpClienttransport - Descriptor-driven operations with per-operation API versions
- Semantics-aware retry and throttling, including protection against ambiguous mutation replay
- Opaque next-link validation and tenant/cloud authority checks
- Permission discovery, comparison, and app-role management
- Sanitized CSV, JSON, Markdown, and vault evidence export
GraphKit does not use Connect-MgGraph or Invoke-MgGraphRequest as its transport. The Microsoft Graph PowerShell SDK maintains process-global state that can interfere with concurrent work across tenants. GraphKit instead owns the request pipeline while using MSAL only for authentication.
- PowerShell 7.4 or later
Microsoft.Graph.Authentication2.38.1 or later, used as the MSAL delivery dependencyMicrosoft.PowerShell.SecretManagement1.1.2 or later- A registered SecretManagement vault when using stored credentials
Register a tenant profile, resolve an execution context, and perform a typed Graph read:
Register-GraphTenant -ProfileId ivy24 -TenantId $tenantId -ClientId $clientId -AuthMode Certificate -CertificateVaultName 'GraphKit'
$context = Get-GraphContext -ProfileId ivy24
Get-GraphObject -Context $context -Type ManagedDeviceOther primary commands include:
Get-GraphTenant
Get-GraphOperation
Invoke-GraphOperation
Invoke-GraphBatch
Test-GraphPermission
Compare-GraphPermission
Export-GraphResultLow-level operations accept an explicit -Context or -ProfileId; callers should resolve the tenant before entering parallel or asynchronous work.
Dependencies and build tools are restored through the repository scripts. Run the test suite through the build entry point rather than invoking Pester directly:
./build.ps1 -ResolveDependency -Tasks noop
./build.ps1 -Tasks pack
./build.ps1 -Tasks testThe pack task begins with Clean, so package before testing. The test task then proves the exact package-producing build and writes the NUnit result consumed by the release gate. Generated artifacts are written under output/ and must not be edited directly.
source/Public/— exported GraphKit commandssource/Private/— transport, retry, paging, throttle, URI, and evidence helperssource/Data/Operations/— operation descriptorstests/Unit/— deterministic policy and pipeline teststests/Adapter/— transport and loopback integration teststests/Concurrency/— runspace isolation and throttling testsdocs/superpowers/specs/— approved architecture and design decisionsscripts/— standalone operational and cutover scripts
GraphKit is intended to provide the reliable Graph plumbing for applications such as IntuneHealthAutomation. Reporting, Excel processing, checkpointing, and application-specific workflows remain outside this module.