Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

In powershell 5.1: Connect-MgGraph timeout behavior regression in versions >= 2.35 (does not respect 2-minute timeout)

未关闭
#3,628 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 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 内容生成。

描述

type:bug
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.
Image

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.
Image

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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoftgraph/msgraph-sdk-powershell 的其他 Issue

查看 microsoftgraph/msgraph-sdk-powershell 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。