Powershell timeout for O365 and Exchange Online
Please allow a configurable timeout for powershell when connecting to O365 and EO. The timeout is too short right now and the new login requirements make it tedious to reconnect
John Foret commented
Not a perfect solution, but I was able to get around the issue by checking the connection state inside of a loop and restoring it if it finds it in a broken state. See link below for code
Harsh Kakkar commented
Is there any update on this ? I have wasted last 3 hours and it would still time out after one hour of running the script to add 20K+ members to a DL. I broke the list in 4 groups with 5K members in each input file but still no luck.
Random Guy commented
This needs to be configurable at the tenant. When having MFA active, long running scripts time out and sometimes ask for re-login. You have to sit in front of the station to randomly wait for the popup. This is just not acceptable. Scripts take a long time to run at 365 especially with large user-base
Ganesh G commented
When we have MFA enabled i dont think it is possible to extend seemless relogin. If any one had a lead to extend the session where MFA is enabled please drop me a note.
Skype for Business Online is also impacted by this.
I'm not sure why it's seen as "Idle" but I agree for long running scripts you definitely need the ability to extend the timeout.
Jeremy Bradshaw commented
FYI: Use Connect-ExoPSSession with the UserPrincipalName parameter and specify your UserPrincipalName along with it. This allows for seamless refresh token refreshing the (can't remember the name) other token - in other words seamless automatic re-logins.
Checkout my Connect-Exchange function (a.k.a. conex) which makes use of the EXO PS module from a regular PowerShell window. It also should have -UserPrincipalName provided for seamless / automatic re-logins. https://github.com/JeremyTBradshaw/PowerShell/blob/master/.functions/Connect-Exchange.ps1
For error handling to make your scripts able to deal with regular session drops to EXO, throttling, and more, checkout my script Get-ADAutoMappingFullAccessStatus.ps1: https://github.com/JeremyTBradshaw/PowerShell/blob/master/Get-ADAutoMappingFullAccessStatus.ps1. I still need to take the multi-catch by error type technique and turn it into a modular/reusable function, but the logic is shown there in the script. That script will run without error against any sized Exchange Online environment and not be phased by connection interruptions or throttling.
I am soon going to summarize the Exchange Online PowerShell error handling techniques I've/I'm learned/learning on my Wordpress site www.jb365.ca.
This needs to be made more extensible especially for long-running scripts.
Agreed. This makes it very difficult to run long-running commands (such as searching all recipients), as they time out before completion.