The ‘Get-AzResourceGroup’ command was found in the module ‘Az.Resources’

In this article, we will discuss how to fix the error “The ‘Get-AzResourceGroup’ command was found in the module ‘Az.Resources’, but the module could not be loaded.” that I got while trying to execute the Get-AzResourceGroup Azure PowerShell cmdlet to retrieve the lists of Azure Resource Groups.

The ‘Get-AzResourceGroup’ command was found in the module ‘Az.Resources’, but the module could not be loaded

Recently, I got a requirement to get all the Resource Groups using Azure PowerShell. So I have executed Get-AzResourceGroup Azure PowerShell cmdlet.

The moment I executed the Get-AzResourceGroup Azure PowerShell cmdlet, I got the below error.

The ‘Get-AzResourceGroup’ command was found in the module ‘Az.Resources’, but the module could not be loaded

The complete error message was as below

Get-AzResourceGroup : The 'Get-AzResourceGroup' command was found in the module 
'Az.Resources', but the module could not be loaded. For more information, run 
'Import-Module Az.Resources'.
At line:1 char:1
+ Get-AzResourceGroup -Location westus2 |
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-AzResourceGroup:String) [], Comman 
   dNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
 

You can see the same error here

the term 'get-azresourcegroup' is not recognized as the name of a cmdlet

Now, let’s find out the way to fix this issue.

The ‘Get-AzResourceGroup’ command was found in the module ‘Az.Resources’, but the module could not be loaded [Solution]

Now, to fix the issue, The ‘Get-AzResourceGroup’ command was found in the module ‘Az.Resources’, but the module could not be loaded. We need to import the Az.Resources module, and then we can run the Get-AzResourceGroup Azure PowerShell cmdlet.

Note: If you are getting any errors while importing the Az.Resources, try opening a new PowerShell session and run the import cmdlet.

Well, run the below Azure PowerShell cmdlet to import the Az.Resources module.

Import-Module -Name Az.Resources

Then, you can run the Get-AzResourceGroup Azure PowerShell cmdlet.

Get-AzResourceGroup

Or, you can execute the Azure PowerShell cmdlet as below.

Import-Module -Name Az.Resources
Get-AzResourceGroup

Once I executed the Azure PowerShell cmdlet, I got the expected output below.

get-azresourcegroup is not recognized

You may also like following the articles below

Voila! How easy to fix the issue The ‘Get-AzResourceGroup’ command was found in the module ‘Az.Resources’. Now, it’s your turn to fix the same issue following the above instructions.