How do you connect to Office 365?

$LiveCred = Get-Credential
Import-module msonline
Connect-MsolService -Credential $LiveCred -verbose
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic –AllowRedirection
Import-PSSession $Session
get-user -Identity "username" | ft identity, whenCreated, whenChanged

Remove-PSSession $Session

1 thought on “How do you connect to Office 365?”

Leave a Comment