Backtrack:  
 
by lunarg on April 20th 2016, at 15:47

A few steps to enable management of your Office 365 subscription using Powershell. One uses Powershell because not all configuration is available through the Office 365 Portal, and it's also useful for automation.

UPDATE (2016-04-20): updated links and information.

Installing the Office 365 cmdlets

  1. This is required in order to be able to sign in to Office 365.
  2. Note: 32-bit users, see below.
  3. Optionally, you can also download and install modules to manage Sharepoint Online and Skype for Business Online.
32-bit Azure AD Module
From October 20, 2014, the Azure Active Directory Module for Windows PowerShell (32-bit version) is discontinued and no longer supported. Only the 64-bit version will continue to be updated. It is therefore highly recommended to install the AAD Module on a 64-bit computer.

After the installation, you will have an icon (desktop or start menu) called: Windows Azure Active Directory Module for Windows PowerShell.

Manage Office 365

To actually make a connection, start the Windows Azure AD Powershell:

$cred = Get-Credential
Connect-MsolService -Credential $cred

This will allow you to manage all things Office365 related, but not Exchange Online.

Manage Exchange Online

Managing Exchange Online works a little differently. This is because you have to connect directly to the Exchange server, which is not the same as Office 365.

The cmdlets for Exchange Online are imported through the internet, so first, you need to change the Powershell execution policy to allow remotely signed modules to be loaded. In an elevated Powershell, run this:

Set-ExecutionPolicy RemoteSigned

This prevents errors about not being digitally signed during import. If the above command is not accepted, you probably don't have admin privileges. Either use an elevated Powershell or ask your network administrator to enable it for you.

To make the actual connection, run these in a regular Powershell:

$cred = Get-Credential
$office365 = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $cred -Authentication Basic –AllowRedirection
Import-PSSession $office365

This will start to import several modules, adding the required cmdlets to your session. When completed without errors, the Exchange management cmdlets will be available. These are roughly the same as on a on-premise Exchange server.

Connect-ExchangeOnline

For future use, you could create a function out of the set of commands and add it to your Powershell profile to easily connect to Exchange Online in the future. First, read this post about profiles, then copy/paste/import the contents of the attached file. This creates a function called Connect-ExchangeOnline, which does the connection and module import for you. Simply run the function without any parameters. It will ask your credentials and do the rest.

Additional information

Additional and most recent information can also be found here: http://powershell.office.com/get-started

 
 
« October 2017»
SunMonTueWedThuFriSat
1234567
891011121314
15161718192021
22232425262728
293031    
 
Links
 
Quote
« I needed a password with eight characters so I picked Snow White and the Seven Dwarves. »