Connect-ExchangeOnlineNonMFA
This is another handy one to use, which allows connecting to Exchange Online easily. Similar to the O365_Logon module I have published, this function includes a prefix option. The prefix appends a value to the noun of cmdlets that allows you to run more than one remote session in the same PowerShell console that you are using (CLI, ISE, VS Code, etc.). This function is available in the MO_Module with simple install of:
Install-Module MO_Module
If you use a prefix, in this case: EOL. Instead of typing in Get-Mailbox, you’d type in Get-EOLMailbox. This prefix option allows you to stay in an on premises environment, with Verb-Noun options by default for example, and use the Verb-EOLNoun options to display the online content.
The Exchange Product Group is building a new Exchange online module and they will be using the Connect-ExchangeOnline, verb-noun option for the connection process that does support modern authentication. Therefore, I'm going to change the function name, as it does not include an MFA option.
The Exchange Online module from the PG will include a new landing point, on REST API back-end, instead of traditional PowerShell. This allows commands to run 6-10 times faster. Think of Get-Mailbox with an online tenant of 100,000 or more users, it times out after an hour. This new module allows Get-Mailbox to run in minutes instead of hours or days. They are using Get-EXOMailbox as the new function. This allows non-conflict of current cmdlets in the O365 service.
While there is a Disconnect-ExchangeOnlineNonMFA function in my module, it will remove the current session, but sometimes, lingering remnants do remain, so it’s just best to close out of the PowerShell application when you’re done.
And again, as I was testing, I sometimes mis-typed my credential information, so I threw in the Request-CredentialExchangeOnlineNonMFA function to make my life easier when working within PowerShell, which is the goal of all these functions. Instead of just having a .ps1 file with code, or worse yet, a .txt file or Word document, that you have to copy/paste code into a PowerShell session, I like having simple verb-noun functions available. Easier to remember, easier to use, and easier to share with people. Sounds like a win-win-win to me. Enjoy.
Mike O’Neill