AZ-104 Question 124
Select 2You are an Azure Administrator for Contoso. The company relies on Infrastructure as Code for all new resource deployments. They recently built a Bicep file to deploy an Azure SQL Database, and the team wants to ensure the resource name is not hard-coded so it can differ between environments. Which two actions should you recommend?
- A
Convert the database name to a parameter in the Bicep file, then pass the value at deployment time.
- B
Hard-code the database name in the Bicep file to maintain consistency across all environments.
- C
Use a parameter file and reference it in the deployment command to supply environment-specific values.
- D
Maintain separate Bicep files for each environment and define the resource name in each file.
Show answer and explanation
Correct answers: A, C
Explanation
Parameters in Bicep and separate parameter files provide a clean, reusable solution for environment-specific resource names. Optionally, you can combine both approaches: parametrize the resource name in the Bicep file and pass the corresponding values via a parameter file.
- A. Correct.
Defining the database name as a parameter in Bicep and providing it at deployment time is a recommended way to allow flexibility and reuse of the same file across different environments.
- B. Incorrect.
Hard-coding the database name removes flexibility, defeating the purpose of dynamic environment deployments.
- C. Correct.
Using a parameter file is a best practice to separate environment-specific configurations from the template, ensuring a single template can be reused with different parameter files.
- D. Incorrect.
Creating multiple Bicep files for each environment increases complexity and maintenance overhead, making it harder to manage common resource definitions.