mgx

1.0.1

Resilient companion for Microsoft.Graph PowerShell. Adds retry, circuit breaker, rate limiting, streaming pagination, batching, and fan-out to any Graph API endpoint.

Minimum PowerShell version

7.5

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name mgx -RequiredVersion 1.0.1

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name mgx -Version 1.0.1

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

(c) 2026 Thomas Maillo Grome. All rights reserved.

Package Details

Author(s)

  • Thomas Maillo Grome

Tags

Microsoft Graph MicrosoftGraph API Azure EntraID Resilience PowerShell Polly Retry RateLimit Batch Delta Throttling Pagination

Cmdlets

Invoke-MgxRequest Invoke-MgxBatchRequest Export-MgxCollection Expand-MgxRelation Set-MgxOption Get-MgxOption Enable-MgxResilience Disable-MgxResilience Get-MgxResilience Get-MgxTelemetry Sync-MgxDelta

PSEditions

Core

Dependencies

Release Notes

v1.0.1
- Added tab completion for Uri parameter on all cmdlets
- Extracted CircuitBreakerMessage protected property on MgxCmdletBase
- Removed redundant XML doc comments on self-documenting members

v1.0.0 - Initial public release

v0.3.0 - Plug-and-play resilience
- NEW: Expand-MgxRelation: pipeline-composable relation enrichment
 - Enrich Graph objects with related data via concurrent fan-out
 - Auto-detects collection vs singleton endpoints (no silent data loss)
 - -Top caps per-relation items (server-side $top + client-side truncation)
 - -Flatten unwraps single-value relations, warns on multi-item
 - -SkipNotFound/-SkipForbidden for partial failure tolerance
 - Chaining: pipe through multiple Expand-MgxRelation stages
- NEW: Enable-MgxResilience / Disable-MgxResilience / Get-MgxResilience: zero-change resilience injection
 - Wraps SDK HttpClient with Polly retry, circuit breaker, and rate limiting
 - All Microsoft.Graph SDK cmdlets (Get-MgUser, etc.) gain resilience automatically
 - Preserves full SDK handler chain (OData, NationalCloud, Redirect, Auth)
 - Re-call after Connect-MgGraph to re-inject
 - Thread-safe for concurrent runspaces
 - Sovereign cloud support (auto-detects Graph endpoint)
- NEW: Get-MgxOption / Set-MgxOption: runtime resilience pipeline tuning
 - 11 configurable parameters: rate limiting, retry, circuit breaker, timeouts
 - CircuitBreakerSamplingDurationSeconds: control the failure measurement window (5-300s)
 - Partial updates: only explicitly passed values are changed
 - Set-MgxOption -Reset restores all defaults
- FIXED: Circuit breaker and rate limiter now shared across cmdlet invocations
 - Previously created fresh per invocation, making both non-functional
 - New ResiliencePipelineFactory manages shared static Polly pipeline
- FIXED: Rate limiter GC root leak on options change
 - TokenBucketRateLimiter holds an internal Timer (GC root via AutoReplenishment)
 - Old limiters now disposed after TotalTimeoutSeconds delay to avoid ObjectDisposedException
- FIXED: nextLink SSRF validation strengthened
 - Rejects non-HTTPS scheme (prevents token leak over plaintext)
 - Compares full authority (host + port), not just host
 - ConcurrentFanOut rejects all nextLinks if initial URL parse fails
- FIXED: FindType() cache no longer caches null results
 - Previously, importing Mgx before Microsoft.Graph permanently broke lookups
- IMPROVED: Request cloning copies Options, Version, and all content headers on retry

v0.2.0 - Restructure as companion module
- NEW: Invoke-MgxRequest: general-purpose resilient client for any Graph endpoint
 - Streaming pagination with -All, -Top, -PageSize
 - Fan-out concurrency with {id} template substitution
 - Write operations (POST, PATCH, PUT, DELETE)
 - -ApiVersion (v1.0/beta), -ConsistencyLevel, -NoPageSize
 - -SkipNotFound/-SkipForbidden for fan-out error handling
 - -Raw for JSON string output, -CheckpointPath for resume
 - Progress reporting, pipeline stop support
 - ArgumentCompleters for tab completion
- IMPROVED: @odata.type preserved as ODataType property (polymorphic queries)
- IMPROVED: DateTime strings parsed to DateTimeOffset
- NEW: Export-MgxCollection: JSONL streaming export with checkpoint/resume
 - Raw JSON to disk, no PSObject overhead, constant memory
 - -All, -Top, -CheckpointPath for resumable exports
 - SupportsShouldProcess for -WhatIf/-Confirm
- IMPROVED: Set-MgxOption only overrides explicitly passed values
- FIXED: Set-MgxOption referenced deleted base class
- REMOVED: Get-MgxUser, Get-MgxGroup, Get-MgxGroupMember, Get-MgxApplication, Get-MgxServicePrincipal, Get-MgxDirectoryRole
 - Use Invoke-MgxRequest '/users', '/groups', etc. instead

FileList

Version History

Version Downloads Last updated
1.0.2 8 4/21/2026
1.0.1 (current version) 10 4/20/2026