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
in the Lab 05 - Implement Intersite Connectivity
Student lab manual 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?
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.