There are different methods for 365/Azure. But to get directly to Exchange Online from Powershell running on Windows, a current update of longstanding methods is as follows.
To install the module:
Set-Executionpolicy RemoteSigned -Scope Process Install-Module -Name ExchangeOnlineManagement Import-Module ExchangeOnlineManagement
To update the module:
Set-Executionpolicy RemoteSigned -Scope Process Update-Module -Name ExchangeOnlineManagement Import-Module ExchangeOnlineManagement
To connect:
Connect-ExchangeOnline -UserPrincipalName admin@domain.com
Current reference, including methods for MacOS and Linux as well:
learn.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2