Backtrack:  
 
by lunarg on January 9th 2017, at 16:33

A new Powershell module, called Azure AD v2 is available to manage Office365 from Powershell, and is now the preferred method for managing Office365 tenants from Powershell. Unlike the older MSOnline module, you need to download and install this version from the Powershell Gallery, for which there is no direct download link.

Windows 10 / Server 2016

Windows 10 already has the PowershellGet module needed to download modules from Powershell Gallery, so all you need to do is run the following in an elevated Powershell:

Install-Module AzureAD

You may get a message about NuGet provider is required to continue. You can safely confirm this.

Windows 7 / Server 2008R2

Everything pre-Windows 10 and starting from Windows 7 SP1 and 2008R2 SP1, you need to manually install the PowershellGet module:

  1. If you don't have .NET Framework 4.5 installed, install it first (download links here).
  2. Download and install PackageManagement PowerShell Modules. This includes the PowershellGet module.

After installation, you can install the Azure AD module as described earlier.