In this azure tutorial, we will discuss how to fix the error, The term ‘New-AzResourceGroup’ is not recognized as the name of a cmdlet. which comes while trying to create a resource group using PowerShell in Azure.
The term ‘New-AzResourceGroup’ is not recognized as the name of a cmdlet
Recently, while trying to execute the below line of cmdlet, i got the above error.
PS C:\windows\system32> New-AzResourceGroup -Name myResourceGroup -Location centralUS

The exact error message was
New-AzResourceGroup : The term ‘New-AzResourceGroup’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At line:1 char:1
- New-AzResourceGroup -Name myResourceGroup -Location centralUS
~~~~~~~- CategoryInfo : ObjectNotFound: (New-AzResourceGroup:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException
To fix this error, you need to follow the below steps
Step-1: Install the Az module using the below cmdlet.
PS C:\windows\system32> Install-Module -Name Az -AllowClobber

Step-2: Now click on the Yes button from the below popup.

Step-3: Now you can see the installation of the Az module is in progress.

Step-4: Once the installation will complete, try executing the below cmdlet again to install the Az module.
PS C:\windows\system32> Install-Module -Name Az -AllowClobber

After executing the above code there is maximum chance you will get the below error.
New-AzResourceGroup: 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’.

Now to fix the above error, You can follow my article The ‘New-AzResourceGroup’ command was found in the module ‘Az.Resources’
You may like following Azure tutorial:
- Microsoft Azure naming conventions
- Azure web app for containers
- What is Azure web app?
- The term ‘Get-VM’ is not recognized as the name of a cmdlet
In this tutorial, we discussed how to fix the error, The term ‘New-AzResourceGroup’ is not recognized as the name of a cmdlet. I hope it helped you to fix your issue.