AZ-104 Question 122
Single answerYou have an existing Bicep file that declares a storage account resource with a hardcoded name. You want to modify the file so that the storage account name can be provided during deployment. Which modification should you implement?
- A
Add a param statement for the storage account name and reference it in the resource’s name property
- B
Replace the existing resource definition with a module declaration that references a hardcoded name
- C
Use an output statement instead of a param to allow name changes at deployment time
- D
Rename the resource’s name property to storageName but continue to hardcode the value
Show answer and explanation
Correct answer: A
Explanation
The best way to allow a customizable resource name in a Bicep file is to declare a param, then reference that param in the resource definition. This ensures the name can be provided during deployment rather than remaining fixed.
- A. Correct.
By introducing a param for the storage account name (e.g., param storageAccountName string) and then using that param in name: storageAccountName, you allow the name to be dynamically supplied during deployment
- B. Incorrect.
Replacing the entire resource definition with a module referencing a fixed name doesn’t enable a new parameter; it simply restructures the code
- C. Incorrect.
Using an output statement will not allow name changes; outputs only capture and expose values after deployment, not receive them as inputs
- D. Incorrect.
Renaming the property without making it param-based still hardcodes the value, so it doesn’t allow for a dynamic name