2

I have created separate ARM templates each for the DocumentDB, Azure SQL Server, Storage Account, Azure Key Vault, Azure Batch, HDInsight Cluster.

Using New-AzureRmResourceGroupDeployment powershell command when I deploy above resources in a loop within the same resource group I found a strange behaviour. While deploying DocDB all my previously deployed resources in the resource group vanishes (probably deleted automatically). Same is the case when I deploy Azure SQL Server.

Has anybody encountered the same issue? Is there a fix?

Sandesh
  • 2,966
  • 1
  • 20
  • 34

1 Answers1

5

New-AzureRmResourceGroupDeployment has a -mode parameter which can be set to either complete or incremental

Complete mode will create a resource group exactly as you define it in a template deleting any resource that is not explicitly defined in the template.

Incremental mode will add or modify resources to achieve what is specified by the template. Ignoring any additional resources that are present within the resource group. Incremental mode will modify any pre-existing resources to match what is in the template.

Michael B
  • 11,887
  • 6
  • 38
  • 74
  • off topic. While deploying storage account using ARM template it always asks me the value of name parameter explicitly even when the value is passed in its parameter.json file. Same behaviour with Azure Batch. Rest all templates are working as expected. Any idea? – Sandesh Jan 29 '16 at 11:07
  • @Sandesh I remember having the same problem at some point! and can't for the life of me remember what it was - something obviously stupid once I'd figured it out though :P – Michael B Jan 29 '16 at 11:12
  • I would be glad if you could scratch your head a bit and recollect what was it. As of now I am quite stumped and clueless – Sandesh Jan 29 '16 at 11:24
  • @Sandesh can you post the files / commands somewhere? a github / gist etc? – Michael B Jan 29 '16 at 11:26
  • I can definitely use pastie. Give me a minute – Sandesh Jan 29 '16 at 11:27
  • @Sandesh It actually sounds like the makings of a new question - help anyone else who is having the same problems – Michael B Jan 29 '16 at 11:28
  • I will search around a bit and even take a close look. Else I will post a new question hopefully tomorrow – Sandesh Jan 29 '16 at 11:32
  • 1
    @Sandesh - that's likely because the parameter name in the template is the same as a parameter used by the PowerShell script. IOW, if you have a param in your template named "location" (one example "name" could be another), you'll get that disambiguate prompt. – bmoore-msft Jan 30 '16 at 02:33
  • @bmoore-msft : Thanks for the comment. I also did figure it out 2 days ago. Just to be on safer side I also restricted the input parameter length to 24 characters and all seems to work now :) – Sandesh Feb 01 '16 at 06:43