How to install the Azure Active Directory PowerShell Module

How to install the Azure Active Directory PowerShell Module

In order to connect to manage users and organisation settings in Office 365 via Powershell, you need to install the Azure Active Directory PowerShell Module. This can be simply installed via PowerShell itself.

Why do you need the Azure Active Directory PowerShell Module?

This module allows you to perform a lot of the Office 365 user and organisation administration tasks via PowerShell. It’s great for bulk tasks like password resets, password policies, license management/reporting etc.

If you’re a Microsoft Partner, and are managing your customers Office 365 tenants via delegated administration, this module gives you a secure way to perform admin tasks using your own credentials. See our guide here for more info.

Importantly, this module doesn’t give you the ability to manage the features of Exchange Online, Skype for Business, SharePoint/OneDrive etc. These require a separate PowerShell connection method or PowerShell module.

How to Install the Azure Active Directory PowerShell Module via PowerShell

  1. Open the Start menu on your computer and search for ‘Powershell’
  2. Right-click on Windows PowerShell and choose ‘Run as administrator’Run PowerShell As Administrator
  3. Type the following command and press enter.
    Install-Module -Name MSOnline
  4. Type “Y” to install and import the NuGet providerInstall Azure Active Directory PowerShell Module with Install-Module MSOnline Cmdlet
  5. Type “Y” again to trust the providerAccept Terms and InstallAzure Active Directory PowerShell Module
  6. Wait for the package to install, then type the following to enter your Office 365 admin credentials and connect to Azure Active Directory via PowerShell:
    Run Connect-MsolService To Connect to Azure Active Directory Powershell Module
  7. Once the Azure Active Directory PowerShell module has been installed, you only need to run the Connect-MsolService command to connect to the Azure AD service on this PC.


To perform Exchange Online Administration tasks, you’ll need to set up a separate connection to Exchange Online via PowerShell. Follow our quick guide here for more info.


Was this article helpful?

Related Articles

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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