I've been using Microsoft Graph PowerShell modules without issues for years, but suddenly none of the cmdlets are working and I keep getting timeout errors. This happens on both PowerShell 5.1 and 7. The only commands that seem to work are connect-mggraph and get-mgcontext, which show an active session with the correct scopes. However, when I try other cmdlets like get-mguser or get-mggroup, I get the error: "The request was canceled due to the configured HttpClient.Timeout of 300 seconds elapsing." Uninstalling and reinstalling the modules didn't help, nor did reverting to an earlier version. I've checked our Entra settings and everything appears normal. Has anyone else experienced this issue?
4 Answers
Thanks for sharing the solution! Specifying the -ContextScope Process parameter worked wonders for me as well.
I tried everything to fix it: deleting all modules, disconnecting, clearing auth from my browser, and even reinstalling PowerShell 7. Still got timeouts trying to call the API directly. It’s frustrating! Would love to know if anyone else has a solution.
It seems to break randomly. Last time, it turned out I had too many versions of the Graph module installed, which caused conflicts.
I've faced similar issues. Sometimes, a script change is necessary, like using a REST API call for authentication instead of relying on the PowerShell cmdlets. It's all part of the unpredictable nature of M365 and PowerShell!
That's a smart approach! Transitioning to direct API calls can be a bit more complex, but it often pays off when dealing with Graph.