Azure AD PowerShell module installation got easier

Azure AD PowerShell module installation got easier

Azure AD PowerShell module was earlier installed by a standard .msi package. Now you can install it using one PowerShell command. However, installation requires PowerShell 5 or newer.

Before you begin

Module installation requires PowerShell 5 or later which is included in Windows 10 & Server 2016. If you have previous version of Windows, you need to install Windows Management Framework 5.1 here.

Installing the Azure AD PowerShell module

To install the latest Azure AD PowerShell module, enter the following commands as an administrator.

Azure AD PowerShell v1 (MsOnline)

# Install the MsOnline module

Install-Module MSOnline

If you haven’t used the Install-Module command earlier, you might not have NuGet provider. Just click the Yes to continue.

alt text

You might also get the following error message stating that PSGallery is untrusted. This is okay so you may safely click the yes button.

alt text

Now you are ready to connect to Office 365!

Connect-MsolService

Azure AD PowerShell v2 (AzureAD)

# Install the AzureAD module

Install-Module AzureAD

Now you are ready to connect to Office 365!

Connect-AzureAD

Azure AD PowerShell v2 preview (AzureADPreview)

Note! AzureAD Preview has same commands than AzureAD, only the module name is different. Therefore, they cannot be installed in the same computer together.

# Install the AzureAD module

Install-Module AzureADPreview

Now you are ready to connect to Office 365!

Connect-AzureAD
Dr Nestori Syynimaa (@DrAzureAD) avatar
About Dr Nestori Syynimaa (@DrAzureAD)
Dr Syynimaa works as Principal Identity Security Researcher at Microsoft Security Research.
Before his security researcher career, Dr Syynimaa worked as a CIO, consultant, trainer, and university lecturer for over 20 years. He is a regular speaker in scientific and professional conferences related to Microsoft 365 and Entra ID (Azure AD) security.

Before joining Microsoft, Dr Syynimaa was Microsoft MVP in security category and Microsoft Most Valuable Security Researcher (MVR).