microsoftgraph / microsoftgraph/msgraph-sdk-powershell
In powershell 5.1: Connect-MgGraph timeout behavior regression in versions >= 2.35 (does not respect 2-minute timeout)
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 898
- Fork
- 230
- Merge medio
- 2g 5h
- PR unite (30g)
- 31
Descrizione
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_
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il comportamento con Connect-MgGraph in Windows PowerShell 5.1 usando le versioni del modulo 2.25.0 e 2.37.0, quindi confrontalo con PowerShell 7. La correzione è completa quando viene rispettato il timeout di circa due minuti e la finestra di dialogo di selezione dell'account WAM si chiude automaticamente; nell'issue non sono identificati file sorgente o test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- powershell
- Ambito
- authentication
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100