Office 365 PS Modules – Quick & Dirty, Connect to all

For those of us that just want to get it done the first time vs. having to connect to each service separately. Here’s how you would connect to ALL O365 Services in one GO.

Reference – For long and short explanations on the “how to”

https://technet.microsoft.com/en-us/library/dn568015.aspx

Modules Required

https://support.office.com/en-us/article/Managing-Office-365-and-Exchange-Online-with-Windows-PowerShell-06a743bb-ceb6-49a9-a61d-db4ffdf54fa6?ui=en-US&rs=en-US&ad=US

The Quick & Dirty

#Connect to MSOnline

$credential = Get-Credential

Import-Module MsOnline

Connect-MsolService -Credential $credential

#Connect to SharePoint Online

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking

Connect-SPOService -Url https://YOURDOMAINNAME-admin.sharepoint.com -credential $credential

#Connect to Exchange Online

$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri “https://outlook.office365.com/powershell-liveid/” -Credential $credential -Authentication “Basic” -AllowRedirection

Import-PSSession $exchangeSession -DisableNameChecking

#Connect to Security and Compliance Online

$ccSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $credential -Authentication Basic -AllowRedirection

Import-PSSession $ccSession -Prefix cc

#Uncomment this to connect to Skype Online

#Import-Module SkypeOnlineConnector

#$sfboSession = New-CsOnlineSession -Credential $credential

#Import-PSSession $sfboSession

To close session

Remove-PSSession $sfboSession ; Remove-PSSession $exchangeSession ; Remove-PSSession $ccSession ; Disconnect-SPOService

One response to “Office 365 PS Modules – Quick & Dirty, Connect to all

  1. Hi Stephanie,

    I noticed you are using the older MSOnline PowerShell module in your examples. It may be useful to start using the newer Azure Active Directory PowerShell V2 module instead, as we will begin deprecating the MSOnline module when we have migrated the functionality of the MSOnline module to the newer module – currently planned for the Spring of 2017.

    Thanks,

    Rob de Jong

Comments are closed.