With the introduction of the security baselines from Microsoft it is necessary for you to use Modern Authentication in your PowerShell scripts/if you want to connect to Exchange Online.

Connecting to Exchange Online is a pretty easy process and you can do so by following the steps below:

  1. Open Powershell and install the Exchange Online module. To do this you will need to run the following command:
Install-Module ExchangeOnlineManagement
  1. After the module has been installed you will want to import the module so the commands are available. To do this you will need to run the following command:
Import-Module ExchangeOnlineManagement
  1. Once the module has been imported you will need to connect to Exchange Online.
Connect-ExchangeOnline -UserPrincipalName <your admin upn>
  1. You will now be prompted for credentials. Provide the credentials and approve the MFA request via your MFA app (Duo, Authenticator, etc.)
  2. If it was successful you will receive a prompt like the one below:
  1. You can now run Exchange Online Powershell commands to administer your Exchange Online tenant.