Skip to content

Try silent Broker (WAM) auth when interactive auth is disabled - #469

Draft
José Cisneros (Josecisneros001) wants to merge 1 commit into
AzureAD:mainfrom
Josecisneros001:josecisneros001/silent-broker-windows
Draft

José Cisneros (Josecisneros001) wants to merge 1 commit into
AzureAD:mainfrom
Josecisneros001:josecisneros001/silent-broker-windows

Conversation

@Josecisneros001

Copy link
Copy Markdown

Addresses the silent-only part of #464.

When interactive auth is disabled (AZUREAUTH_NO_USER or Corext_NonInteractive=1), Windows reduced every mode to IWA only. On Entra-joined machines without on-prem AD, IWA fails, even though WAM could issue a token silently. This PR adds silent Broker (WAM) after IWA wherever Broker already runs on Windows. It also makes Broker silent-only on every platform when interaction is disabled.

Platform, interaction disabled Before After
Windows 10/11 and Server (version 10.0), mode includes broker (default) CachedAuth, IWA IWA, Broker (silent)
Windows, web / devicecode only CachedAuth, IWA unchanged
Windows before 10 CachedAuth, IWA unchanged (Broker unavailable)
macOS / Linux, mode includes broker Broker, which could still prompt Broker (silent)

As in other modes since #419, the separate CachedAuth flow is skipped when Broker runs; Broker's own silent lookup replaces it. IWA stays ahead of Broker, so agents where IWA works never call WAM; WAM is documented as unsupported in service sessions. The silent Broker call uses the existing 30 s CachedAuth timeout. silentOnly is a Broker option because the silent and interactive attempts happen inside the single Broker flow, so the flow chain alone cannot stop after the silent one.

Testing

  • Unit tests: MSALWrapper.Test 186 passed / 1 skipped, AzureAuth.Test 110, AdoPat.Test 95. There are new tests for:
    • silent-only Broker (no interactive call on a miss)
    • the filtered mode and silentOnly reaching IMsalWrapper
  • Non-Windows branches: compiled with -p:DefineConstants=TRACE. Not run on a real macOS or Linux machine.
  • Manual, Windows 11 Entra-joined, AZUREAUTH_NO_USER=1, Release publish:
    • Default mode, ADO scope: token in about 3 s.
    • 0.9.5 baseline: no token.
    • --mode web / devicecode: CachedAuth and IWA only, exit 1, no UI.
    • Consent-required scope / nonexistent resource: WAM error, exit 1, no UI.
    • Not tested as SYSTEM or in a service session.

Not covered

#464 also asks for a machine-readable "interaction required" result and an interaction policy independent of --mode. This PR does neither. If IWA is removed (#454), Broker becomes the only silent flow here. I'm happy to follow up in whichever direction you prefer.

LLM disclosure: GitHub Copilot helped investigate and draft this change. I reviewed it and ran the validation above.

When AZUREAUTH_NO_USER or Corext_NonInteractive disables interaction, Windows now tries silent Broker after IWA instead of IWA only, and Broker never falls back to an interactive prompt on any platform.

Addresses the silent-only part of AzureAD#464.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Josecisneros001

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Microsoft"

This branch has not been deployed

No deployments
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