Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The term 'New-AzResourceGroupDeployment' is not recognized as the name of a cmdlet, function

I need to run below command in my PowerShell :

New-AzResourceGroupDeployment 
    -Name Myrg1010 
    -ResourceGroupName ADFcslResourceGroup 
    -TemplateFile C:\ADFARM.json 
    -TemplateParameterFile C:\ADFARM-Parameters.json

Before running this command I have connected to my Azure subscribtion

Connect-AzAccount

But I have below error :

New-AzResourceGroupDeployment : The term 'New-AzResourceGroupDeployment' 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-AzResourceGroupDeployment -Name MyARMDeployment -ResourceGroupNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (New- 
   AzResourceGroupDeployment:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

I found this article but this is not my case because my powershell version is 5.1.2

Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     5.1.2      Azure                               {Get- 
AzureAutomationCertificate, Get-AzureAutomationConnection, New-AzureAuto...

Could you please tell me what should I do?

like image 559
Ardalan Shahgholi Avatar asked Dec 03 '22 18:12

Ardalan Shahgholi


1 Answers

You need to install the Azure Powershell module:

You can look for just the one for this command:

Install-Module -Name Az.Resources -AllowClobber -Scope CurrentUser

Or all of them:

Install-Module -Name Az -AllowClobber -Scope CurrentUser

See here for details

like image 159
Scepticalist Avatar answered Dec 06 '22 19:12

Scepticalist