The Specified Module ‘AzureRM’ Was Not Loaded

This PowerShell Azure tutorial will discuss how to fix the error. The specified module ‘AzureRM’ was not loaded that comes while trying to import the AzureRM module using the Azure PowerShell cmdlet.

The Specified Module ‘AzureRM’ Was Not Loaded

Recently, while working with the Azure PowerShell, while trying to import the AzureRM module, I got the error: The specified module ‘AzureRM’ was not loaded because no valid module file was found in any module directory. Below is the PowerShell cmdlet I executed to import the AzureRM module PowerShell.

PS C:\WINDOWS\system32> Import-Module AzureRM

Once I executed the above PowerShell cmdlet, I got the error: The specified module ‘AzureRM’ was not loaded. You can see it below

The specified module 'AzureRM' was not loaded

The exact error message was as below

Import-Module: The specified module ‘AzureRM’ was not loaded because no valid module
file was found in any module directory.

At line:1 char:1

  • Import-Module AzureRM
  • ~~~~~
    • CategoryInfo : ResourceUnavailable: (AzureRM:String) [Import-Module],
      FileNotFoundException
    • FullyQualifiedErrorId: Modules_ModuleNotFound,Microsoft.PowerShell.Commands.Im
      portModuleCommand

The Specified Module ‘AzureRM’ Was Not Loaded [Solution]

Well, to fix the above issue, we need to follow the below steps

1. Open the PowerShell ISE using the Run as Administrator mode.

iimport-module azurerm.profile

2. Run the below PowerShell cmdlet to ensure you have the PowerShell Get-Module installed on your local machine.

PS C:\WINDOWS\system32> Get-Module PowerShellGet -list | Select-Object Name,Version,Path
import-module : the specified module 'az' was not loaded because no valid module file was found in any module directory.

3. Now, run the below PowerShell cmdlet to install the AzureRM module as shown below

Install-Module AzureRM -AllowClobber
import-module azurerm

Now click on the Yes to All button to confirm the installation of the AzureRM module. Once you click on the Yes to All button, the installation of the AzureRM module starts, as shown below.

azurerm.profile

4. Now, To make sure the AzureRM module is installed successfully, you can run the below PowerShell cmdlet

Get-InstalledModule
'AzureRM' module not found

5. Now rerun the below PowerShell cmdlet to import the AzureRM module to work with the Azure PowerShell module. This time, you won’t get any error.

azurerm module

How to fix the error: The above steps did not load the specified module ‘AzureRM’.

You may also like following the article below

Wrapping Up

In this article, we have learned how to fix the error. The specified module ‘AzureRM’ was not loaded. I hope this will help you to fix your issue !!!