WAM interactive browser auth stops working mid-session when running PowerShell scripts via background terminal
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 2.1k
- Fork
- 153
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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.
Hướng dẫn đóng góp
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- powershell
- Lĩnh vực
- authentication, desktop
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100