New-AzResourceGroupDeployment not working

Sundeep Kumar 1 Reputation point
2021-05-27T15:19:18.337+00:00

I am trying to run the following command in cloud powershell:

$location = 'UK West'
$rgName = 'az104-07-rg0'
New-AzResourceGroup -Name $rgName -Location $location

Above succeeds

Followed by:

New-AzResourceGroupDeployment -ResourceGroupName az104-07-rg0
-TemplateFile az104-07-vm-template.json -TemplateParameterFile az104-07-vm-parameters.json
-AsJob

Which does nothing except give me the following output on screen. I have uploaded the Template and parameters file. Any ideas why this is happening:

PS /home/sundeep> New-AzResourceGroupDeployment `

> -ResourceGroupName $rgName > -TemplateFile $HOME/az104-07-vm-template.json
> -TemplateParameterFile $HOME/az104-07-vm-parameters.json `
> -AsJob

Id Name PSJobTypeName State HasMoreData Location Command


16 Long Running O… AzureLongRunni… Running True localhost New-AzResourceGroupDeplo…

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,331 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Olga Os - MSFT 5,941 Reputation points Microsoft Employee
    2021-05-27T15:53:48.783+00:00

    Hello @Sundeep Kumar ,

    Welcome to the MS Q&A.
    I have suspicious how exactly you pass the TemplateFile parameter to specify the template and the TemplateParameterFile parameter to specify a file that contains parameters and parameter values.

    I searched for the lab with the same name and noticed what author first uploads file and next providing the path where these files store:

    100313-image.png

    100288-image.png

    Please try to complete the same lab again by following the exact steps in the lab scenario.

    -----------------------------------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Sincerely,
    Olga O

    0 comments No comments

  2. Sundeep Kumar 1 Reputation point
    2021-05-27T16:10:42.38+00:00

    Hi Olga - thanks for the quick reply.

    I am running the lab exactly as it shows. I upload the correct Template and Parametre file to the home directory. After running the resource group deployment I get this output in shell:

    100372-deployment-issue.png


  3. Trong Nguyen 0 Reputation points
    2023-01-25T13:08:04.22+00:00

    I think the reason why the New-AzResourceGroupDeployment command and ARM templates/scripts doing nothing because of the StatusCode: 404 issue. To see the issue when executing this command, you can remove/exclude the last paramter "-AsJob" from the line. As you can see in following screenshot, I did upload both template & template parameter files to the Cloud Shell (verified by using dir command) and still have issue. I am not sure what causes this issue so I have to upload the files (template & parameter) to my Storage Account and using TemplateUri (with SAS token) instead of TemplateFile in this approach.

    User's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.