Repository navigation
Reapply #3833: Allow getting an access token using the broker - #3896
Open
Ramses Sanchez-Hernandez (ramsessanchez) wants to merge 1 commit into
Open
Ramses Sanchez-Hernandez (ramsessanchez) wants to merge 1 commit into
Ramses Sanchez-Hernandez (ramsessanchez) wants to merge 1 commit into
Conversation
Ramses Sanchez-Hernandez (ramsessanchez)
requested a review
from a team
as a code owner
November 5, 2026 20:20
Contributor
Author
|
Hi Stephan van Rooij (@svrooij) , it looks like I merged your original pr prematurely. There was an issue at build/test time because the isolation boundary was not preserved in this implementation. Could you take a look here? Feel free to add to this branch and marge any changes here. It will automatically trigger CI runs. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relates to #2023 and #3806; reapplies #3833 after #3895.
Changes proposed in this pull request
5dd9caa95adf5dc74cd4a1bde16ebeccd81f567e(Allow getting an access token using the broker, Allow getting an access token using the broker #3833), preserving Stephan van Rooij's original authorship and author date and the existing co-author attribution.main, after confirming Revert #3833 to restore Authentication assembly isolation #3895 merged at2026-11-05T01:48:31Zas8824ce39ab53ba6b9e1984a3e5ee7daf2d0270b8.Get-MgAccessToken, session token caching, token metadata, tests, and documentation. Broker sign-out code predates Allow getting an access token using the broker #3833 and is not part of this patch.Required review change: preserve the isolation boundary
src/Authentication/Authentication/Cmdlets/GetMgAccessToken.cs, around lines 99–109, directly uses Azure.CoreAccessToken, the returnedTokenCredential, andTokenRequestContextto acquire/cache/refresh tokens. This introduces anAzure.Coreassembly reference intoMicrosoft.Graph.Authentication.dll, which runs in PowerShell's default load context rather than the private dependency context.Move token acquisition, caching, and refresh behind an API in
Microsoft.Graph.Authentication.Core, exposing only non-Azure boundary types to the cmdlet assembly. Do not weaken, remove, or broaden the allowlist of the isolation guards. BothCmdletAssemblyMustNotReferenceIsolatedDependenciesandCmdletAssemblyOnlyReferencesAllowedAssembliesmust pass before this can merge.This is the blocker originally seen in #3864, build
259330, before workload generation. The revert #3895 was validated with 93/93 Authentication tests passing on each ofnet8.0andnet472.Actual local validation of this reapplication
Executed on Windows:
Both targets build and execute. The command exits with code 1, with exactly the expected failures on each target:
CmdletAssemblyMustNotReferenceIsolatedDependencies:Microsoft.Graph.Authentication.dll references isolated assemblies: Azure.Core. Move the offending code into Microsoft.Graph.Authentication.Core.CmdletAssemblyOnlyReferencesAllowedAssemblies:Microsoft.Graph.Authentication.dll has unexpected references: Azure.Core.No other Authentication unit tests failed or were skipped. An initial
--no-restoreattempt reported missingproject.assets.json; the run above restored assets and completed. Restore/build also emitted existing package advisory warnings forSystem.Security.Cryptography.Xml8.0.4 and obsolete-API/xUnit analyzer warnings; no dependency changes were made. Interactive broker flows and the PowerShell/Pester suite were not run.git diff --exit-code 5dd9caa95adf5dc74cd4a1bde16ebeccd81f567e HEADsucceeded, confirming the reapplication introduces no additional tracked changes.Other links