In this azure tutorial, we will discuss how to fix the error, The ‘New-AzResourceGroup’ command was found in the module ‘Az.Resources, but the module could not be loaded. which comes while trying to create a resource group using PowerShell in Azure.
The ‘New-AzResourceGroup’ command was found in the module ‘Az.Resources’
I got the below error while trying to create a resource group which I need to use to create a recovery services vault.
The ‘New-AzResourceGroup’ command was found in the module ‘Az.Resources’, but the module could not be loaded. For more information, run ‘Import-Module Az.Resources’.
To create the resource group, I was trying to execute the below command.
New-AzResourceGroup -Name "mynewresgroup123" -Location "West US"
See here

Now to fix this error, I need to import the Az.Resources module. Below is the command I need to execute to do so.
Import-Module Az.Resources
There is a chance you will get the below error while executing the above line of code.
Import-Module : File C:\Program Files (x86)\WindowsPowerShell\Modules\Az.Resources\1.13.0\Az.Resources.psm1 cannot be loaded because running scripts is disabled on this system. For more information, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
To fix this error, you can follow my article Powershell error – Az.Resources.psm1 cannot be loaded because running scripts is disabled on this system
Once you fix this error you can run the below line of code
New-AzResourceGroup -Name "mynewresgroup123" -Location "West US"
It is asking to connect to the Azure Run Connect-AzAccount to login

Now you can run the below command to connect to the Azure from PowerShell.
Connect-AzAccount
It will ask to enter your username and password then it will show your subscription details.

Now you can run the below line of code to create the resource group.
New-AzResourceGroup -Name "mynewresgroup123" -Location "West US"

You may like following Azure tutorial:
- How to Create a Recovery Services vault in Azure
- Unable to find package providers (NuGet)
- Reset password in Azure virtual machine
- Powershell error – Az.Resources.psm1 cannot be loaded because running scripts is disabled on this system
- How to create and add members to Azure Active Directory Group
- The term ‘Get-AzureADDirectorySettingTemplate’ is not recognized as the name of a cmdlet
In this Azure tutorial, we discussed how to fix error, The ‘New-AzResourceGroup’ command was found in the module ‘Az.Resources’, but the module could not be loaded.