Welcome to my journey of continuous discovery. Enjoy your visit.
As you being to test new commands and methods, it will be handy to run individual commands directly versus via a script.
With Office 365 there are three different services; Azure AD (AAD, a.k.a. MS Online), Exchange Online and Exchange Online Protection (EOP)
The connect-o365-all-services.ps1 will prompt you for you online credentials and store them encrypted, so you wont need to enter them again. It then connects you to all three services.
This script is a good example of how to accept command line parameters (lines 6-12) and the Convert-To/From-SecureString to securely store the credentials for later use (lines 17-29).