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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With