0

I've exported the ARM template for an Azure VM from the resource group where it was created and I've seen that what gets exported is a zip containing a template.json file and a parameters.json file.

The thing that somehow surprised me is the two distinct files. I would have expected a single file with the values in the parameters.json file appear as default values in the template.json file but this is not so, the template.json file in the parameters section only provides the name and type of each parameter.

I'm not sure I get how should be using these two files. If I load the exported template.json file as a template spec in the azure portal and try to deploy it I'll be asked to provide manually values for each of the parameters and this is why it would have been great to see the values in parameters.json added as default values directly in template.json.

Do I really need to add these default values manually in template.json or is there any better way to utilize the values exported into template.json?

GordonBy
  • 3,099
  • 6
  • 31
  • 53
whatever
  • 2,492
  • 6
  • 30
  • 42

1 Answers1

1

The exported JSON from the portal is a starting point to preparing your template. If often parameterises too aggressively, names the parameters poorly and there will be other nuances to making the Json Iac better. I agree, it would be nice if the more options were provided in the export generation... and I've come to view it as this is the price we pay for not authoring IAC from the beginning.

I'd suggest looking at Bicep (makes ARM authoring a lot easier), paste as bicep which will interpret your exported json, then you can just parse the file cleaning up the names and values of the parameters.

GordonBy
  • 3,099
  • 6
  • 31
  • 53