AZ-104 Question 113
Single answerYou are an Azure administrator for an organization that needs to deploy a multi-tier application environment repeatedly. The environment consists of a web app, an Azure SQL database, and a storage account. The solution must ensure the resources use consistent settings while allowing different configurations (like dev, test, and production) with minimal changes in a single Bicep file. Which approach should you use to achieve this goal?
- A
Define parameters and variables in the Bicep file to dynamically configure resource settings
- B
Use parameters and outputs in the Bicep file for all resource definitions
- C
Create multiple resource modules in the same file without parameters for each environment
- D
Embed conditions directly within each resource definition to switch environments
Show answer and explanation
Correct answer: A
Explanation
Parameters enable you to provide environment-specific values (like naming conventions and resource sizes), and variables allow for reusing expressions or computed values within the template. This approach ensures that a single Bicep file can be easily adapted for different environments without hard-coding settings in multiple locations.
- A. Correct.
Using parameters allows for different environment-specific values, and variables help reuse computed values or expressions across resources
- B. Incorrect.
Outputs do not replace variables for within-template reuse; they primarily return data from the deployment
- C. Incorrect.
Multiple resource modules without parameters would not allow easy customization for different environments
- D. Incorrect.
Embedding conditions in every resource definition can be overly complex and does not facilitate simple configuration changes