- Fixed encoding issue breaking scripts on PS 5.1 - Em dash characters (U+2014) in comments and strings caused
Invoke-MSGraphOperation(and other functions) to fail when installed from PSGallery, because PS 5.1 reads BOM-less UTF-8 files using the system ANSI codepage, mangling multi-byte characters into mojibake. - Replaced all non-ASCII characters with ASCII equivalents across all 14 affected
.ps1/.psm1files. - Normalized line endings from CRLF to LF across all source files.
- Trimmed trailing whitespace in 6 files.
- Added missing final newlines in 6 files.
.editorconfig- Enforces ASCII-only (latin1) for PowerShell files, LF line endings, 4-space indentation, trailing whitespace trimming, and final newlines. Prevents future encoding regressions.
- MSAL.PS dependency removed — The module no longer requires or uses MSAL.PS. All authentication is 100% native REST via
Invoke-RestMethod. Get-AccessTokenreplaced byConnect-MSGraphRequest—Get-AccessTokenis now a backward-compatibility alias that maps toConnect-MSGraphRequest. Existing scripts usingGet-AccessTokenwill continue to work.- Global variables replaced with script-scoped state —
$Global:AuthenticationHeaderand$Global:AccessTokenare no longer used. Connection state is stored in$script:MSGraphConnectionand$script:AuthenticationHeader(module-internal). - Minimum PowerShell version raised from 5.0 to 5.1.
Connect-MSGraphRequest— Single entry-point for authentication supporting six flows:- Interactive (Authorization Code + PKCE with localhost redirect)
- Device Code
- Client Secret (client credentials)
- Client Certificate (JWT client assertion, RS256)
- Managed Identity (Azure VM IMDS and App Service)
- Bring Your Own Token
Disconnect-MSGraphRequest— Securely clears all tokens, secrets, and connection state.- Automatic token refresh —
Invoke-MSGraphOperationnow automatically refreshes expired tokens in the Begin block. Supports all six flows (Interactive/DeviceCode use refresh_token, ClientSecret/ClientCertificate re-acquire, ManagedIdentity re-requests, BYOT warns). - Custom header preservation — Headers added via
Add-AuthenticationHeaderItem(e.g.consistencylevel = eventual) are preserved across automatic token refreshes. - Default Client ID — Interactive and DeviceCode flows default to the well-known Microsoft Graph PowerShell app (
14d82eec-204b-4c2f-b7e8-296a70dab67e) when no ClientId is specified. - PKCE mandatory — Interactive auth uses Authorization Code + PKCE with state validation (CSRF protection).
Show-AuthenticationInforewritten — Now displays FlowType, Identity, TokenType, TenantId, Scopes, AppId, and custom header items.-FullDetailsdecodes the full JWT payload.
- Fixed
$bodyvariable collision inInvoke-MSGraphOperationauto-refresh that could overwrite POST/PATCH/PUT request bodies. - Fixed PowerShell 5.1 incompatibility with
RandomNumberGenerator::Fill()andSHA256::HashData()static methods. - Fixed
AliasesToExportin manifest blocking theGet-AccessTokenbackward-compat alias. - Fixed
$ErrorIDbeing undefined in error record construction (now uses$ResponseBody.ErrorCode). - Fixed PS7+ error parsing crash when
ErrorDetails.Messageis null (network timeouts, DNS failures). - Fixed
TenantIdnot being stored in connection state for Interactive, DeviceCode, and ClientSecret flows. - Fixed silent no-op when refresh token is missing for Interactive/DeviceCode flows (now warns).
- Fixed
GetRSAPrivateKey()extension method not available on all .NET runtimes (falls back to.PrivateKey). - Initialized
$GraphResponseProcessbefore thedo...untilloop to prevent reliance on implicit null behavior.
ConvertFrom-JwtToken— Decodes JWT header and payload from base64url.Get-TokenContext— Extracts identity, scopes, tenant, expiry from a JWT.New-ClientAssertion— Builds RS256-signed JWT for certificate auth.Invoke-TokenRequest— Centralized POST to the token endpoint with cross-platform error parsing.Invoke-InteractiveAuth— Auth Code + PKCE via HttpListener and browser.Invoke-DeviceCodeAuth— Device code polling flow with rate-limit handling.Invoke-ManagedIdentityAuth— Azure IMDS and App Service managed identity.
- Added 72 Pester v5 tests covering all private helpers, Connect/Disconnect, Invoke-MSGraphOperation (paging, throttling, auto-refresh, header preservation), and all public functions.
- Bugfix for POST action without body parameter.
- Bugfix for DELETE action.
- Added option to decode JWT token in Show-AuthenticationInfo with -Full switch.
- Bug fix in Test-AccessToken where TotalMinutes was used instead of Minutes for token expiry calculation.
- Added Show-AuthenticationInfo function.
- Added Remove-AuthenticationHeaderItem function.
- Added Add-AuthenticationHeaderItem function.
- Adjusted Invoke-MSGraphOperation for module usage.
- Added Test-AccessToken function.
- Added New-AuthenticationHeader private function.
- Initial release with Invoke-MSGraphOperation and Get-AccessToken.