WAM interactive browser auth stops working mid-session when running PowerShell scripts via background terminal
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 2.1k
- Fork
- 153
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Short summary
PowerShell scripts using Connect-MgGraph (Microsoft Graph SDK) authenticate successfully via WAM on first run, but fail with "A window handle must be configured" later in the same session after terminal canvas panels are opened/closed.
Affected version or release
Latest (updated 2026-07-09)
Installation context
Windows desktop app, background terminal used to run PowerShell scripts via agent session
What happened?
When running PowerShell scripts that call Connect-MgGraph with interactive browser auth via the Copilot app background terminal, WAM authentication worked correctly on first run. Later in the same session — after opening and closing terminal canvas panels — the same scripts started failing immediately with:
InteractiveBrowserCredential authentication failed: A window handle must be configured.
See https://aka.ms/msal-net-wam#parent-window-handles
The WAM browser prompt no longer appears at all; it fails without waiting for user interaction. The background PowerShell process appears to lose its window handle mid-session, likely caused by terminal canvas lifecycle events. Workaround is to use -UseDeviceCode on Connect-MgGraph, but interactive browser auth should remain stable throughout a session.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start by reproducing the issue with Connect-MgGraph in the background PowerShell terminal, then open and close terminal canvas panels before retrying interactive browser authentication. Investigate how the background terminal and terminal canvas lifecycle preserve the WAM window handle. Done means interactive browser authentication continues to show its prompt and succeeds throughout the session without requiring -UseDeviceCode.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- powershell
- Ambito
- authentication, desktop
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100