Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do install AzureAD PowerShell module

When I try to install the AzureAD module I get the following error:

Import-Module -Name AzureAD

Import-Module : The specified module 'AzureAD' was not loaded because no valid module file was found in any module directory.

like image 959
kumar Avatar asked Jul 12 '19 10:07

kumar


People also ask

How do I import AzureAD module into PowerShell?

Follow these steps to install the Microsoft Azure Active Directory Module for Windows PowerShell: Open an elevated Windows PowerShell command prompt (run Windows PowerShell as an administrator). Run the Install-Module MSOnline command. If you're prompted to install the NuGet provider, type Y and press Enter.

How do I install a PowerShell module?

Installing PowerShell modules from the PowerShell Gallery is the easiest way to install modules. To install a package or module from the Gallery, we use the command: Install-Module or Install-Script cmdlet, depending on the package type.


1 Answers

Import-Module loads a PowerShell module which you have already installed on your system. It looks like in your case, the module hasn't been installed yet.

To install Azure AD PowerShell, you need to use Install-Module:

Install-Module -Name "AzureAD"

If you would like to install the module to the current user (i.e. without administrator privileges), you can do this:

Install-Module -Name "AzureAD" -Scope CurrentUser

The documentation for the Azure AD PowerShell module (and how to install it) is at: https://learn.microsoft.com/powershell/azure/active-directory/install-adv2?view=azureadps-2.0#installing-the-azure-ad-module

like image 109
Philippe Signoret Avatar answered Oct 29 '22 07:10

Philippe Signoret