Connessione a Office365 con PowerShell

$credentials = Get-Credential
Write-Output "Getting the Exchange Online cmdlets"
$Session = New-PSSession -ConnectionUri https://outlook.office365.com/powershell-liveid/ -ConfigurationName Microsoft.Exchange -Credential $credentials -Authentication Basic -AllowRedirection
Import-PSSession $Session