In previous article, we have seen how to deploy a bicep file using a VS Code extension. While performing those steps, the bicep deployment wizard asked if we have any parameter file and if we want to generate a new file. In this article, we are going to have a look at what does parameter file contains.
What is a parameter file ?
In previous article, we passed individual parameter values in the wizard. Instead of passing every parameter value separately, there is an option to specify all the parameter values together in a file. This file is called as bicep parameter file. A bicep parameter file is basically a json file.
It is a general naming convention to include the word – parameters – in the name of the bicep file. For example, let’s say we create a file first.bicep, which has few parameters. Then the bicep parameter file name can be first.parameters.json.
It is possible that you may have different parameter values for different environment. For example, if the bicep file has a parameter environment name, then it would certainly be different for different environments. In that case, the naming can include environment name in the file name.
For example, If first.bicep is the bicep file, then first.parameters-dev.json can be the parameter file for dev environment, first.parameters-test.json can be the parameter file for the test environment and first.parameters-prod.json can be the parameter file for containing parameter values for production environment.
What are contents of parameter file ?
As already mentioned in this article, a parameter file is basically a JSON file. The code snippet given below shows the general format of any parameters file. The code snippet shows 4 different parameters of different types.
It is important to note that the JSON file should contain only those parameters, which are defined in the bicep file. Otherwise we may get an error while deploying.
A parameter file is a JSON file. Hence all the parameter values are stored as plaintext. Hence, for security reasons, it may be good idea to avoid putting any sensitive values in the parameters file. We can use Azure Key Vault to store the secrets and then we can use getSecret() function to get the value of secret from key vault.
I hope you find this information helpful. Let me know your thoughts.