Created: 8-30-21

Updated: 8-30-21

Use the following coding below in a PowerShell ISE  Script Project:

######################################
# Log into O365 Security & Compliance
######################################
Set-ExecutionPolicy RemoteSigned
$UserCreds = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking

Remove-PSSession $Session