How to Connect to Office 365 Using a PowerShell Function and Exchange

Body:

Office 365 

If you have to connect to Office 365 and Exchange Admin Centers at the same time, here you have this commands to connect to both services:

​Function Login-365 {
$365Cred = Get-Credential
Import-Module MSOnline
Connect-MSOLservice -Credential $365Cred
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $365Cred -Authentication Basic –AllowRedirection
Set-ExecutionPolicy Unrestricted
Import-PSSession $Session 

You can run Get-Mailbox and Get-MsolUser at the same time.

Published: 4/5/2014 22:35
]]>