Specifying Azure Resource Manager parameters on the command line instead of in JSON files
Most of the Azure Resource Management template examples demonstrate using two JSON files. One file is the template definition that accepts a set of named parameters. The other file contains the parameter values. The two files are accepted by the template engine and combined to create the actual definition.
The Azure CLI supports providing parameters in JSON files or as name/value pairs on the command line. Parameters are always specified using --parameters. The command-line option supports two different syntaxes and can be invoked multiple times to provide property values from multiple JSON files and as command-line arguments.
The middle example represents invoking the CLI with the two filenames
The right-hand example represents involving the CLI with a template and a list of command-line parameter values.
Refer to https://github.com/freemansoft/vnet-p2s-vpn-bastion-azure/blob/main/4-create-storage.sh
Pros and cons of JSON parameter files
- You can check the parameter file into GitHub.
- You can create a parameter file for each different environment/tenant.
- Each parameter file must provide exactly the parameters required by the template and no more. This means you can't create a common parameter file that is shared across templates.
- Scripts may have to construct parameter files if some of the parameter values can only be determined at invocation time.
- Values are spread across multiple files.
- No obvious way of inheriting parameter values from other parameter files.
Azure CLI invoking ARM with command line parameters
Azure Resource Management Template - Parameter fragment
Video Explanation
Created 2021 /09
Comments
Post a Comment