Introduction

Windows PowerShell has become the first choice for administrators to manage Windows Server roles and features. The use of PowerShell is seen on a large scale considering the fact it helps you save a lot of time in managing a Windows environment. Azure and Office 365 tenants can also be managed using PowerShell cmdlets. Almost any action that you perform in Office 365 and Azure using the Office 365 Admin Center and Azure Portal respectively can also be achieved by using the Azure and Office 365 PowerShell cmdlets. There are different PowerShell cmdlets available to manage Azure and Office 365 subscriptions.

It is important to note that to manage Office 365 services using PowerShell, you will be required to use different PowerShell modules. For example, to manage Windows Azure Active Directory, or WAAD in short, you are required to install Windows Azure Active Directory Module for Windows PowerShell. Similarly, to manage Exchange Online, you will be required to install Exchange Online PowerShell modules. In the first part of this article series, we will explain requirement and how to install PowerShell cmdlets for use with Office 365 WAAD. We will also take a look at the list of PowerShell cmdlets that are available to manage Office 365 WAAD. Subsequent parts of this article series, then will focus on managing WAAD, Exchange, SharePoint and Lync Services use their own PowerShell modules.

When you subscribe for Office 365 services, you are given a free Windows Azure Active Directory that you can manage either using Azure Portal or by using the PowerShell cmdlets that are available in the “Azure Active Directory Module for Windows PowerShell”. However,the free Azure Active Directory (WAAD) can only be managed via Azure Portal only if you have purchased a business plan. In other words, Office 365 trial that is applicable for 30 days does not allow you to manage WAAD via Azure Portal. In case you have subscribed for an Office 365 trial for evaluating purposes, there is no way to manage WAAD except using PowerShell cmdlets available in “Azure Active Directory Module for Windows PowerShell”.

Requirements and Installation

Before you start exploring PowerShell cmdlets for managing Office 365 WAAD, make sure to have the following requirements in place:

A computer running Windows 7 or later Operating System must be available for Office 365 WAAD cmdlets.

Office 365 work or school account that you can use to connect to Office 365 WAAD.

And a copy of Windows Azure Active Directory Module for Windows PowerShell here.

Verifying Installation

Once you have installed Azure Active Directory Module for Windows PowerShell, click start > search and then type “Windows Azure Active Directory”, right click on the shortcut and then open the PowerShell window under the security context of local administrator.

When installing “Windows Azure Active Directory Module for Windows PowerShell” you do not receive any confirmation indicating that the PowerShell cmdlets for managing Office 365 WAAD have been installed successfully. You can verify the installation by running the “Get-Module | Select-Object Name, Path | FL” PowerShell command. Get-Module cmdlet helps you get a list of PowerShell modules that have been installed on the local computer as shown in the screenshot below:

Figure 1.0: Get-Module to display the list of Powershell Modules Installed on Local Computer

As you can see in the Figure 1.0 above, the command also lists the “MSOnline” module and that is the module that was added to the system when you installed “Windows Azure Active Directory Module for Windows PowerShell” from the above link. This is sometimes referred to as MSOnline. The module file MSOnline.PSD is a text file that you can read using a text editor such as Notepad. The module file contains author name and .NET class information for Office 365 cmdlets. However, it does not contain the execution instructions for each cmdlet. The execution instructions are maintained in the DLL files as listed below:

'Microsoft.Online.Administration.Automation.PSModule.dll',

'Microsoft.Azure.ActiveDirectory.Client.Framework.dll',

And 'Microsoft.Online.Identity.Federation.PowerShell.dll'

If you see “MSOnline” module in the list, this indicates that the Office 365 module for managing WAAD has been installed successfully on the local computer.

Exploring Office 365 PowerShell cmdlets

You need to sign in to your Office 365 account before you can use any of the PowerShell cmdlets. But before we begin with the process of connecting to an Office 365 tenant, let’s explore PowerShell cmdlets available with the “Windows Azure Active Directory Module for Windows PowerShell”.

You might want to see as to what all cmdlets are available in MSOnline DLLs. To get a list of all cmdlets, run below command:

Get-Command –Noun Msol* | FL

Since all Office 365 cmdlets has an “Msol” noun, running the above command will give you a list of PowerShell cmdlets that has “Msol” noun as shown in the Figure 1.1 below.

Figure 1.1: Getting the list of MSOL cmdlets

When you run above command, it returns a list of all the PowerShell modules that are available with the Office 366 WAAD PowerShell module. The screenshot does not show information about all the cmdlets, but I wanted to get your attention by explaining that the each cmdlet is defined in a DLL file. As you can see for “Set-MsolPasswordPolicy” cmdlet, the DLL that contains the execution instructions is “Microsoft.Online.Administration.Automation.PSModule.DLL” file as indicated in the red square of the Figure 1.1 above.

Summary

In the first part of this article series, we gave an overview of Office 365 PowerShell cmdlets and how to install ‘Windows Azure Active Directory Module for Windows PowerShell” module for managing the Office 365 WAAD instance. As we explained, it is easy as pie to install Office 365 WAAD module. We also explained the steps we can use to verify the installation.

As we know by reading the above article, each Office 365 cmdlet is defined in a DLL file. The DLL file contains the execution instructions. The second part of this article series will focus on useful Office 365 PowerShell cmdlets that can help you reduce the time it takes to perform certain Office 365 WAAD tasks.

If you would like to read the other parts in this article series please go to:

Featured Links

Nirmal Sharma

Nirmal Sharma is a MCSEx3, MCITP and was awarded the Microsoft MVP award in Directory Services and Windows Networking. He specializes in Microsoft Azure, Office 365, Directory Services, Failover Clusters, Hyper-V, PowerShell Scripting and System Center products. Nirmal has been involved with Microsoft Technologies since 1994. In his spare time, he likes to help others and share some of his knowledge by writing tips and articles on various sites.

Latest Podcast

Follow Us

Deep Dive Into Office 365 PowerShell Cmdlets (Part 1)

TECHGENIX

TechGenix reaches millions of IT Professionals every month, and has set the standard for providing free technical content through its growing family of websites, empowering them with the answers and tools that are needed to set up, configure, maintain and enhance their networks.