Skip to content

Add Graph national cloud endpoint support#264

Open
ronanflannery wants to merge 2 commits into
svrooij:mainfrom
ronanflannery:feature/national-cloud-graph-support
Open

Add Graph national cloud endpoint support#264
ronanflannery wants to merge 2 commits into
svrooij:mainfrom
ronanflannery:feature/national-cloud-graph-support

Conversation

@ronanflannery

Copy link
Copy Markdown

Summary

Adds Microsoft Graph national cloud endpoint support to WinTuner while preserving the existing global-cloud behavior as the default.

Supported environments:

  • Global (Commercial / GCC )
  • US Government L4 / GCC High
  • US Government L5 / DoD
  • China operated by 21Vianet

Changes

  • Adds central Graph cloud environment and endpoint mapping.
  • Adds an -Environment option to Connect-WtWinTuner, including aliases such as USGov, GCCHigh, and DoD.
  • Supports configuration through the WINTUNER_ENVIRONMENT environment variable.
  • Uses the selected cloud for the Microsoft identity authority, Graph base URL, scopes, allowed hosts, and direct Graph requests.
  • Requires a tenant-specific app registration client ID for interactive authentication in national clouds.
  • Preserves backward compatibility by keeping Global as the default environment.
  • Adds tests verifying that configured Graph base URLs are used.

Validation

  • dotnet format WingetIntune.sln --verify-no-changes
  • dotnet test WingetIntune.sln --configuration Release
  • 95 tests passed
  • Validated authentication and Intune app operations against a GCC High tenant.

Related

Related discussion: #263

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Microsoft Graph national cloud support by introducing a centralized cloud-environment mapping and wiring the selected environment through authentication authority, Graph base URL, allowed hosts, and direct Graph requests—while keeping Global as the default.

Changes:

  • Introduces GraphCloudEnvironment/GraphCloudEndpoint mapping and parsing helpers for Global/USGov/DoD/China.
  • Threads the selected Graph environment into MSAL-based auth providers and Graph client creation (base URL + allowed hosts).
  • Updates direct Intune Graph extension requests to respect the configured RequestAdapter.BaseUrl, and adds a test for the configured base URL behavior.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/WingetIntune.Tests/GraphExtensions/GraphServiceExtensionsTests.cs Adds coverage ensuring configured (non-global) Graph base URLs are used.
src/WinTuner.Proxy.Client/WinTunerProxyClientExtensions.cs Implements telemetry opt-out detection via an env var helper.
src/WingetIntune/WingetServiceCollectionExtension.cs Uses centralized Graph endpoint constant for the default HttpClient base address.
src/WingetIntune/Intune/IntuneManager.cs Uses centralized Graph endpoint constants/allowed hosts when building a Graph client.
src/WingetIntune/Internal/Msal/PublicClientAuth.cs Uses selected cloud authority + host matching for MSAL public-client auth.
src/WingetIntune/Internal/Msal/InteractiveAuthenticationProvider.cs Uses selected cloud authority + host matching for interactive MSAL auth.
src/WingetIntune/Graph/GraphServiceClientExtensions.cs Builds direct-request URIs from the configured RequestAdapter.BaseUrl.
src/WingetIntune/Graph/GraphCloudEnvironment.cs Adds environment enum + endpoint definitions and parsing/alias handling.
src/WingetIntune/Graph/GraphClientFactory.cs Allows specifying Graph base URL when creating a GraphServiceClient.
src/Svrooij.WinTuner.CmdLets/Commands/Graph/*.cs Uses selected environment’s Graph beta endpoint when creating Graph clients.
src/Svrooij.WinTuner.CmdLets/Commands/Graph/ConnectWtWinTuner.cs Adds -Environment selection (and env var default), configures authority/scopes/allowed hosts accordingly, and validates ClientId for national-cloud interactive auth.
src/Svrooij.WinTuner.CmdLets/Commands/Deploy/*.cs Uses selected environment’s Graph beta endpoint when creating Graph clients for deployment operations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants