MSOnline Module

 

Good old MSOL module (with cmdlets à la ‘Get-MsolUser‘). Good if you want to do basic Azure AD / O365 account or group management.
It was the first PowerShell module and was often believed obsolete and soon depreciated. But it is still valid because it can do things all the others can’t. Like displaying or restoring deleted O365 accounts, getting MFA related properties for users, or getting group license assignment information. The official name for this module is Azure Active Directory Module for Windows PowerShell. Please remember that Microsoft encouraged admins to use the newer AzureAD module (see below) instead of this module. So whenever you can do the same task with the newer module, you should replace the MSOL script code.

There is a detailed blog article “How to install and use the MSOL PowerShell module“.

AzureAD Module

 

This was intended as the successor to the MSOL, it has cmdlets like ‘Get-AzureADUser’. For environments with a large number of Azure AD user accounts or group objects, you get faster results from the cmdlets than in the MSOL module (I say three words: Server Side Filters). This module is technically based on the Graph API (see below), and in some cases, you get other properties and more info for some object types. The official name for this module is Azure Active Directory PowerShell for Graph. There is a preview version of this module named “AzureADPreview” which contains the most modern features available to play around with.

There is a detailed blog article “How to install and use the AzureAD PowerShell module“.

 

To connect to the MSonline.

Install-module MSOnline > accept any prompts for untrusted repositories

Connect-MSOLService –> then enter your O365 Global Admin details

Import-Module MSOnline –> imports the commands

Get-MsolUser -UserPrincipalName ‘[email protected]‘ |Select LastPasswordChangeTimestamp