How To Configure PowerShell For O365

Since most of the SharePoint implementation paradigms are moving fast towards cloud based hosting it has now become crucial to get hands on with the respective cloud counterparts of On Premise SharePoint Implementations.

We will see the details on how to setup a machine to start working with “SharePoint Online Management Shell” in the upcoming articles but in this article we will see the details on how to setup a machine to start working with PowerShell in O365. Since SharePoint Online is a part of Office 365 Platform it is necessary to have some understanding on the basic operations of O365 first.

Let’s first discuss the prerequisites for configuring PowerShell for O365.

Prerequisites

We need to install the following two components in order to get PowerShell working for O365 right from your Windows PowerShell console or SharePoint Management Shell console

  • Microsoft Online Services Sign-In Assistant
  • Windows Azure Active Directory Module for Windows PowerShell 

Install Microsoft Online Services Sign-In Assistant

You can download this component from the following Url.

  • Visit the Url and Click Download

    1
  • Select 64 Bit .msi file as shown below

    2
  • Choose Run once and get the popup notification

    3
  • Let the installation go until another screen appears

    4
  • Accept the License Terms and Click Install5
  • Allow the Installation by clicking Yes

    6
  • Let the installation run and wait for  further instructions78
  • Click Finish to exit the Installer on completion9

With this we are done with the installation of Microsoft Online Services Sign-In Assistant.

Now let’s see the steps involved in installing the next component.

Install Windows Azure Active Directory Module for Windows PowerShell

You can download this component from the following Url.

  • Visit the Url
  • Choose Run once and get the popup notification

    10
  • Click Next to continue with the installation

    11
  • Accept the License agreement and click Next to continue with the installation

    12
  • Choose the installation Path or continue with the defaults
  • Click Next to continue
    13
  • Click install to Start the Installation
    14
  • Allow the Installation by clicking Yes15
  • Let the installation run and wait for further instructions16
  • Click Finish to exit the Installer on completion
    17

With this we are done with the installation part. The next thing would be to verify if the components are installed as expected and SharePoint Online Management Shell is responding.

Verify configuration of SharePoint Online Management Shell

I am assuming that you have got a valid O365 Developer Account as we will need it in the upcoming steps.

If you don’t have the O365 Developer Account yet, you can create it by navigating to https://products.office.com

Follow the steps below in order to verify the “SharePoint Online Management Shell” is responding as expected:

  • Launch SharePoint 2013 Management Shell18
  • Run the following commands

Import-Module MSOnline

19

$userCredentials = Get-Credential

Enter your O365 Credentials when asked.

20

Connect-MSOLService -Credential $userCredentials

Try connecting to MSOLService by using the above command and see if we get success

21

If the Command Prompt returns without any errors that means we are able to connect to the service successfully.

22

Get-MSOLUser

Try exporting the list of Active Users using the above command and see if it is responding with the correct user information

23
We can see user information is returned by this Command . PowerShell of O365 is configured as expected and we are good to go.🙂

24

We can further verify this information by logging into Office 365 Admin Center

  • Browse https://login.microsoftonline.com
  • Enter O365 Credentials and login25.png 
  • On the Home page select Admin Center Tile

    26
  • Once you reach Admin Center Page, select Users >Active Users from left navigation

    27

Sure enough we can see the same User Information as returned by this Command, this ensures that we are done with configuration of PowerShell for Office 365 correctly.

I will meet you again in my upcoming articles with some more useful commands to work with SharePoint Online & Office 365.

Hope you find this helpful.