AZ-104 Question 125
Single answerYou have created a Bicep file to deploy an Azure Virtual Network for different environments. The Bicep file includes a parameter named 'vnetPrefix' which defaults to '10.0.0.0/16'. You need to temporarily override this value to '192.168.0.0/24' for a test environment deployment using the Azure CLI without permanently changing the default. Which method should you use?
- A
Modify the default value for 'vnetPrefix' permanently in the Bicep file to '192.168.0.0/24'
- B
Supply the parameter override in the Azure CLI command using --parameters vnetPrefix=192.168.0.0/24
- C
Replace the default parameter value by editing the generated JSON template before deploying
- D
Provide a template link with the new address prefix in the Bicep file’s main parameters section
Show answer and explanation
Correct answer: B
Explanation
By supplying --parameters vnetPrefix=192.168.0.0/24 in the Azure CLI, you can override the default value only for that specific deployment. This avoids permanent changes to the Bicep file and aligns with best practices for flexible parameter management.
- A. Incorrect.
Changing the default permanently in the Bicep file forces all environments to use the new prefix and does not allow flexible overrides for different environments.
- B. Correct.
Using --parameters in the Azure CLI command allows you to override parameters for a specific deployment without altering the default value in the Bicep file.
- C. Incorrect.
Editing the JSON template directly each time is error-prone and not a recommended best practice for parameter overrides.
- D. Incorrect.
Linking a new prefix in the Bicep file’s main parameters section still requires changing the Bicep file, rather than the deployment command.