Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Where do the Parameters -Location1 and -Location2 in New-AzResourceGroupDeployment come from

This week I am attending the AZ-104 training where I personally have some specific interest in Azure PowerShell were the training itself is actually more focused on administrating.
In several occasions, I have find myself questioning whether I have to revise my knowledge of PowerShell or simply over looking something as e.g. the command New-AzResourceGroupDeployment which doesn’t appear to have a -Location1 or -Location2 parameter (also not in the local help) but executes without any error…

New-AzResourceGroupDeployment `
  -ResourceGroupName $rgName `
  -TemplateFile $HOME/az104-05-vnetvm-loop-template.json `
  -TemplateParameterFile $HOME/az104-05-vnetvm-loop-parameters.json `
  -location1 $location1 `
  -location2 $location2

Where do the Parameters -Location1 and -Location2 in New-AzResourceGroupDeployment come from?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

They are dynamic parameters that become available once you have specified a -TemplateFile or -TemplateUri argument, corresponding to the parameters defined in the given template file.

Quoting from the "Description" section of the New-AzResourceGroupDeployment help topic (emphasis added; reformatted):

To use a custom template to create a resource group, specify the
-TemplateFile parameter or -TemplateUri parameter.
Each template has parameters for configurable properties.

To specify values for the template parameters, specify the -TemplateParameterFile parameter or the -TemplateParameterObject parameter.

Alternatively, you can use the template parameters that are dynamically added to the command when you specify a template.

To use dynamic parameters, type them at the command prompt, or type a minus sign (-) to indicate a parameter and use the Tab key to cycle through available parameters.
Template parameter values that you enter at the command prompt take precedence over values in a template parameter object or file.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading