In large tenancies (50,000+) remote powershell is incredibly slow, frequently hits throttling limits and often times out. The following article talks about trying to make scripts efficient to workaround the issue: http://blogs.technet.com/b/exchange/archive/2015/11/02/running-powershell-cmdlets-for-large-numbers-of-users-in-office-365.aspx
Please try and improve reliability and performance of remote powershell for large tenants. It is currently not fit for purpose.
Embry Fedora commented
Microsoft recently added EXO V2 module which, contains REST-based cmdlets that are much faster and more reliable.
-You can easily download from PowerShell gallery
-It supports Modern Auth
-Single cmdlet lets you to connect both MFA and non-MFA accounts.
-EXO V2 module contains REST-based cmdlets
Jeremy Bradshaw commented
This is a copy paste from my comment on a similar idea, but it applies here too:
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.