In powershell 5.1: Connect-MgGraph timeout behavior regression in versions >= 2.35 (does not respect 2-minute timeout)
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- powershell
调研方向
首先,在 Windows PowerShell 5.1 下使用模块版本 2.25.0 和 2.37.0 通过 Connect-MgGraph 重现该行为,然后将其与 PowerShell 7 进行比较。当约两分钟的超时得到遵守且 WAM 账户选择对话框自动关闭时,修复即告完成;该 issue 中未确定源文件或测试。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
We've observed a change in timeout behavior for Connect-MgGraph across different versions of the Microsoft.Graph PowerShell module. In our teams this behaviour is
In version 2.25:
- The expected timeout of approximately 2 minutes is respected.
- The account selection window (interactive login) closes correctly when the timeout is reached.
In versions 2.35 and later:
- The operation no longer respects the ~2 minute timeout.
- Instead, it fails after approximately 5 minutes.
- Additionally, the WAM account selection dialog does NOT close automatically when the timeout occurs.
- The dialog remains open indefinitely until manually closed by the user.
Actual behavior:
- Timeout occurs after ~5 minutes.
- WAM dialog remains open and must be closed manually.
This appears to be a regression compared to version 2.25, even though previously it was indicated that timeout behavior had not changed.
The WAM dialog not closing is a known issue?
If needed, we can provide additional environment details.
Additional context:
- This behavior has been reproduced across multiple machines.
- Several team members are experiencing the same issue, so it does not appear to be limited to a single environment or device.
Thanks
Expected behavior
- Timeout occurs after ~2 minutes.
- WAM dialog closes automatically.
How to reproduce
Run with 2.25 first and then with 2.37.0
$ini = Date
Write-Output "${ini}: Inicio"
powershell.exe -command {
$tenantId = "xxxx"
Connect-MgGraph -ErrorAction stop -ContextScope Process -TenantId $tenantId
}
$fin = Date
Write-Warning ("Tardó: {0}" -f ($fin - $ini).totalminutes)
SDK Version
2.37.0
Latest version known to work for scenario above?
2.25.0
Known Workarounds
The workaround I found now is not working, sometimes connect-mggraph hangs
UPDATE: As 2026-07-02 with 110 seconds of timeout the workaround is working
With powershell 7 the behaviour is the correct (change powershell.exe to pwsh.exe)
Debug output
Click to expand log
```</details>
### Configuration
Name Value
---- -----
PSVersion 5.1.22621.6931
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.6931
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
### Other information
_No response_
- 主要语言
- C#
- 星标
- 902
- 派生
- 233
- 平均合并
- 1 天 22 小时
- 30 天内合并 PR
- 29
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoftgraph/msgraph-sdk-powershell 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
microsoftgraph/msgraph-sdk-powershell#3752 ·
维护者通常 2 天内回复
-
status:waiting-for-triage type:bug
难度 4/5 3-5 天 新手友好度 22/100
microsoftgraph/msgraph-sdk-powershell#3822 ·
维护者通常 2 天内回复
-
status:waiting-for-triage type:bug
难度 4/5 3-5 天 新手友好度 48/100
microsoftgraph/msgraph-sdk-powershell#3819 ·
维护者通常 2 天内回复
-
Connect-MgGraph on 2.41 crashes when making a connection with cert, fixes when using 2.39 or lower未关闭status:waiting-for-triage type:bug
难度 4/5 3-5 天 新手友好度 48/100
microsoftgraph/msgraph-sdk-powershell#3816 ·
维护者通常 2 天内回复
-
status:waiting-for-triage type:feature
难度 4/5 3-5 天 新手友好度 45/100
microsoftgraph/msgraph-sdk-powershell#3806 · 3 条评论 · 3 个 reaction ·
维护者通常 2 天内回复
查看 microsoftgraph/msgraph-sdk-powershell 的全部 Issue
相似的 Issue
-
再現済み 要トリアージ 誤判定
难度 2/5 1-3 小时 新手友好度 72/100
yksr-melt/Meltype#421 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
Facepunch/sbox-public#12063 · 1 条评论 ·
维护者通常 2 天内回复
-
documentation
难度 2/5 1-3 小时 新手友好度 84/100
facioquo/stock-indicators-dotnet#2316 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
lostindark/DriverStoreExplorer#477 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
eriknihlen/OpenAC#219 ·
维护者通常 1 天内回复