Below are the steps that can be used to connect Microsoft Office 365 easily.
Run Windows PowerShell (run as administrator)
Execute below commands:
1: $Cred = Get-Credential
This will open a pop-up window insert your Office365 account credentials
2: $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic -AllowRedirection
3: Import-PSSession $Session
Now you shall able to execute any command depends on the provided account credentials privileges.