8

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?

Ardalan Shahgholi
  • 11,967
  • 21
  • 108
  • 144

2 Answers2

21

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

Scepticalist
  • 3,737
  • 1
  • 13
  • 30
5

Whenever you get a cmdlet error, you need to check if the modules are installed, as mentioned in the comment, try installing

Install-Module -Name Az -AllowClobber -Scope CurrentUser

Az Module

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396