The Specified Module ‘AzureRM’ Was Not Loaded

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

The Specified Module ‘AzureRM’ Was Not Loaded

Well, recently, while working with the Azure PowerShell, while I was 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 was the PowerShell cmdlet that 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

Sep-1: Open the PowerShell ISE using the Run as Administrator mode.

install microsoft azure powershell module

Step-2: Run the below PowerShell cmdlet to make sure you have the PowerShell Get-Module is installed on your local machine.

PS C:\WINDOWS\system32> Get-Module PowerShellGet -list | Select-Object Name,Version,Path
The specified module 'AzureRM' was not loaded because no valid module
file was found

Step-3: Now, run the below PowerShell cmdlet to install the AzureRM module as shown below

Install-Module AzureRM -AllowClobber
Azure rm

Now click on the Yes to All button to confirm the installation of the AzureRM module, Once you will click on the Yes to All button, you can able to see it started the installation of the AzureRM module as shown below.

install azurerm

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

Get-InstalledModule
'AzureRM' module not found

Step-5: Now run the below PowerShell cmdlet again to import the AzureRM module in order to work with the Azure PowerShell module. This time you won’t get any error.

AzureRM module not loaded

This is how you can fix the error The specified module ‘AzureRM’ was not loaded by following the above steps.

You may also like following the below article

Wrapping Up

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