Skip to content

0.3.2: WAM-free Graph sign-in via MgGraphCommunity (required, auto-installed)#67

Closed
ugurkocde wants to merge 1 commit into
hotfix/0.3.1from
feature/mggraphcommunity-auth
Closed

0.3.2: WAM-free Graph sign-in via MgGraphCommunity (required, auto-installed)#67
ugurkocde wants to merge 1 commit into
hotfix/0.3.1from
feature/mggraphcommunity-auth

Conversation

@ugurkocde

Copy link
Copy Markdown
Owner

Summary

Switches all Microsoft Graph authentication and requests from Microsoft.Graph.Authentication to MgGraphCommunity, making interactive sign-in work without the WAM broker. The module is required and installed automatically on first run.

Stacked on the 0.3.1 hotfix branch (PR #66); GitHub will retarget this PR to main once #66 merges.

What changed

  • Startup bootstrap: the #Requires -Modules Microsoft.Graph.Authentication line is gone (it blocked startup before any install UI could run). Instead the script checks for MgGraphCommunity at launch and auto-installs it from the Gallery, so Install-Script users need zero manual steps.
  • Sign-in flows: Interactive (now classic browser PKCE, no WAM), device code, certificate thumbprint, and client secret all map 1:1 to Connect-MgGraphCommunity parameter sets. Client secret now passes -ClientId explicitly as the module requires.
  • Requests: both retry wrappers (script + PlaybookHelpers + embedded copies) and all direct call sites use Invoke-MgGraphCommunityRequest -OutputType Hashtable for shape parity with the SDK cmdlet. Long sessions no longer die at token expiry: the module refreshes proactively and retries 401 reactively.
  • Error handling: the module throws message-text errors ("Graph error 403 [code]: ...") instead of exceptions carrying .Response, so status-code extraction in the wrappers and the 403/404 checks now parse the message. The actionable-403 feature from 0.3.0 reads $batch body statuses and is unaffected.
  • Prerequisites dialog + README updated; version bumped to 0.3.2 with changelog entry.

Verification

  • Installed MgGraphCommunity 1.4.0 from the Gallery and confirmed every cmdlet and parameter the script uses exists (all four connect flows, request params, context fields Account/ClientId/TenantId/Scopes).
  • Extracted the rewritten retry wrapper from the script and tested it against mocked module-style errors: 403 surfaces without retry with parseable status, 429 retries to success, 500 retries then throws, pagination walks nextLink. All pass.
  • Parse, XAML, and embedded-playbook-sync CI checks pass locally.
  • Not yet exercised against a live tenant GUI session (requires Windows); flows map 1:1 so behavior should be unchanged apart from the browser-based interactive login.

🤖 Generated with Claude Code

Replaces Microsoft.Graph.Authentication with the MgGraphCommunity module
for all Graph sign-in and requests. Interactive login now uses the classic
browser authorization-code flow (PKCE) instead of the WAM broker that the
Graph SDK made mandatory in v2.34.0, which blocks secondary and service
accounts. Device code, certificate, and client secret flows map 1:1.

- The module is checked and auto-installed at startup (the old #Requires
  line would have blocked startup before any install UI could run).
- All requests go through Invoke-MgGraphCommunityRequest with hashtable
  output for parity with the SDK cmdlet. Tokens now refresh automatically
  during long sessions (proactive refresh plus reactive 401 retry).
- Retry wrappers and 403/404 checks parse status codes from the module's
  message format instead of $_.Exception.Response, which it does not set.
- Prerequisites dialog and README updated; version bumped to 0.3.2.

Verified against MgGraphCommunity 1.4.0 from the Gallery: cmdlets and
parameter sets used by every flow resolve, and the extracted retry
wrapper passes 403/429/500/pagination tests against mocked module errors.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ugurkocde ugurkocde deleted the branch hotfix/0.3.1 July 7, 2026 20:39
@ugurkocde ugurkocde closed this Jul 7, 2026
@ugurkocde ugurkocde deleted the feature/mggraphcommunity-auth branch July 7, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant