How to install Azure AD PowerShell modules



Background

Once upon a time, you were able to download a nice MSI distributable of Azure AD PowerShell module, but alas this has since been pulled in favor of downloading the modules directly in PowerShell. There are a few items to consider though before you can install AzureAD PowerShell module.

 

How to

First of all, you need to be running PowerShell version 5 or later. There is an easy way to check the version you have. Open PowerShell and run the following command:

$psversiontable.psversion

AzureAD01

If you are running a version less than 5, then you need to grab the Windows Management Framework available here http://aka.ms/wmf5download

Once this is installed, you can then run the Import-Module command. To install AzureAD run the following command:

Install-Module AzureAD

This will pop up with a couple of prompts to accept. If you do not have NuGet installed, it will ask to install this first.

Now, if you are installing this to gain access to Office 365 services, for example, chances are you are going to want to run the command ‘Connect-MsolService‘. This is not included as part of the AzureAD PowerShell module. You will receive the error ‘The term Connect-MsolService is not recognized as the name of a cmdlet‘. Similar story with the command ‘Import-Module MSOnline‘.

To add the MSOnline module, simply run the following command:

Install-Module MSOnline

AzureAD02

And that’s it, you should be set to connect to AzureAD and Office365 with PowerShell.

 

Ian

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.