Overview
Microsoft released new AzureAD PowerShell v2 recently and this KB explains how to install it.
Details
1. Open PS console or PS ISE on the modules machine
2. Check PowerShell version (Should be supported from PS 3.0)

$PSVersionTable.PSVersion

3. Check whether AzureAD PowerShell v2 is installed

Get-Module -ListAvailable -Name AzureAD

4. Try e.g command (works only for PowerShell v5):

Find-Module -Name AzureAD

In case it is not recognized, you need to install PackageManagement PowerShell Modules (It is probably not required if PowerShell 5.0 is installed, otherwise you will find it here)
5. Install AzureAD PowerShell v2 via command:

Install-Module -Name AzureAD

(FYI: The module cannot be found via Programs & Features app, it is possible in certain situations v2 module needs to be imported “Import-Module -Name AzureAD“)
In case of popup, just confirm installation of NuGet, and repository:


6. Check whether AzureAD PowerShell v2 is installed:

7. Now it should be possible to connect:

$password = convertto-securestring -String "*****" -AsPlainText -Force
$UserCredential = New-object -typename System.Management.Automation.PSCredential -argumentlist "account@domain.onmicrosoft.com",$password
$Session = New-PSSession -Name QTSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session

Instead of conecting to MSOlservice (Connect-MsolService -Credential $UserCredential) connect to AzureAD:

Connect-AzureAD -Credential $UserCredential

8. Check if it working e.g:

Get-AzureADSubscribedSku

In case you got results your installation of AzureAD PowerShell v2 was successful. 

Print Friendly, PDF & Email