AZ-104 Question 114
Single answerYou manage an Azure environment where you need to deploy identical sets of resources (App Service, SQL Database, and Storage Account) to multiple environments (development, test, production). You want to minimize the amount of repeated code in your templates while allowing each environment to use distinct configuration parameters. Which approach is the most appropriate?
- A
Create one large ARM template that includes all environment definitions and directly references environment-specific settings
- B
Use modules or linked templates to group repeated resource definitions, then pass environment-specific parameters when deploying
- C
Generate separate parameter files for each resource, without including reusable resource code blocks
- D
Duplicate the resource definitions across different environment templates to keep them clearly separated
Show answer and explanation
Correct answer: B
Explanation
Bicep modules or linked ARM templates enable you to encapsulate reusable resource definitions. By passing environment parameters (e.g., SKU, location) into shared code blocks, you reduce duplication and maintain consistency across different environments.
- A. Incorrect.
This approach leads to a very large template and intertwines environment settings directly, making it hard to maintain differences across environments
- B. Correct.
Using modules (in Bicep) or linked templates (in ARM) allows you to reuse the same code for identical resources, while passing different parameters for each environment
- C. Incorrect.
This method only addresses parameter differences but does not centralize the resource definitions into reusable building blocks
- D. Incorrect.
Duplicating resource definitions across multiple templates can lead to significant maintenance overhead when changes are required