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:
- Open Powershell and install the Exchange Online module. To do this you will need to run the following command:
Install-Module ExchangeOnlineManagement
- 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
- Once the module has been imported you will need to connect to Exchange Online.
Connect-ExchangeOnline -UserPrincipalName <your admin upn>
- You will now be prompted for credentials. Provide the credentials and approve the MFA request via your MFA app (Duo, Authenticator, etc.)
- If it was successful you will receive a prompt like the one below:

- You can now run Exchange Online Powershell commands to administer your Exchange Online tenant.