Microsoft Cloud services and PowerShell

This is probably one of the most blogged topics, so this post is mostly a helper for myself; to document how to access the different Online and Cloud services from Microsoft via PowerShell.

Windows Azure Active Directory is easy

$MsolCredential = Get-Credential
Connect-MsolService -Credential $MsolCredential

Windows Azure has multiple ways of doing it, but for quick access just

Add-AzureAccount

Exchange Online is a bit longer

# Set credentials
$UserCredential = Get-Credential

# Configure Session
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

# Import Session
Import-PSSession $Session

# Prefix trick when importing Session
Import-PSSession $Session -Prefix "EO"

# Turns for example Get-Mailbox into Get-EOMailbox. Could get handy
# Exit Session
Remove-PSSession $Session

SharePoint Online is no pain at all

Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential admin@contoso.com

Lync Online is more like Exchange

$credential = Get-Credential

$session = New-CsOnlineSession -Credential $credential

Import-PSSession $session

Remove-PSSession $session
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s