O365 and PowerShell

by Robi 13. March 2018 21:14

Part 1

There has been quite a rise in migrations to the O365 platform lately, so I decided to present the different possibilities for managing the O365 environment with PowerShell scripts. In order to properly manage O 365 with scripts, each service needs to be handled in a slightly different way and could also demand some additional installations.

Getting ready

In order to be able to connect to O365, first we must install some additional software.

Microsoft Online Services Sign-In Assistant

You can find the Microsoft Online Services Sign-In Assistant software at the following address:

Download Microsoft Online Services Sign-In Assistant for IT Professionals RTW from Official Microsoft Download Center

https://www.microsoft.com/en-us/download/details.aspx?id=41950

Microsoft Online Services Sign-In Assistant is a tool that allows us to sign-in to Microsoft Online Services. The tool is not meant for a "Single Sign-On" experience for companies. It simply allows us to sign-in to services, that Microsoft offers in the cloud.

Azure Active Directory Connection

Azure Active Directory Connection is a piece of software that installs all the necessary commands for connecting to Microsoft Online Services. For that reason, all commands have the prefix "MSOL". After installing it, we can check all the available commands in PowerShell with the help of the following command:

Get-Command -Noun "msol*"

The tool can be downloaded from the following address:

Download Details | Microsoft Connect

http://connect.microsoft.com/site1164/Downloads/DownloadDetails.aspx?DownloadID=59185

Azure Active Directory PowerShell

Microsoft Online Services Sign-In Assistant is just a piece of software that knows how to authenticate users to cloud services. Installing it does not provide us with management capabilities. By installing Azure Active Directory PowerShell, our PowerShell environment gets the cmdlets necessary to perform different operations on our AzureAD. The installation of this add-on is very straightforward and can be performed in PowerShell. All you need to do, under the condition that you are running PowerShell v5 and as an admin, is to run the following command:

Install-Module AzureAD

This command imports the appropriate components and the cmdlets we need to manage our AzureAD settings.

Connecting to O365 services

By installing the above stated add-ons, we can now successfully connect to O365 and AzureAD. In order to check how it works and to acquaint ourselves with the MS Online commands, we can run the following command in our PowerShell environment:

Connect-MsolService -Credential (Get-Credential)

The command line will ask for our credentials and if PowerShell has successfully connected to the cloud services, all we will see is a blank line. We don't get any confirmation upon successful authentication.

In order to check if we are really getting any information about our subscription, we can run the following commands:

Get-MsolDomain

It must list all the domains registered in our tenant.

By successfully connecting to the services we are using in the cloud, we have come to the end of the first part in what is to be a series of articles on O365 and PowerShell. In the next articles we will take a look at:

  • Connecting and managing Skype for Business
  • Exchange Online
  • SharePoint Online and PnP
  • Teams

For any additional information, you can contact me at robi.voncina@kompas-xnet.si.

Robi Vončina

SharePoint MVP

Tags:

Office365 | PowerShell

Add comment

Calendar

<<  June 2018  >>
MonTueWedThuFriSatSun
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

View posts in large calendar

Page List

Month List