github / github/app

WAM interactive browser auth stops working mid-session when running PowerShell scripts via background terminal

オープン
#1,801 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
Bugs
主要言語
言語のデータがありません
スター
2.1k
フォーク
153
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
powershell
領域
authentication, desktop
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。