az-104 Practice Question 1720
Exam: az-104
Domain: Deploy and manage Azure compute resources
Topic: Automate deployment of resources by using templates
Difficulty: medium
Contoso Ltd is deploying a new web application in Azure. They want to use ARM templates to automate the deployment process. The application requires a virtual machine with a specific size and an associated public IP address. Which ARM template parameter should be used to specify the virtual machine size, and how should it be configured in the template to ensure the correct size is applied during deployment?
Answer Options
A
Use the `type` property in the virtual machine resource to specify the size.
B
Define a `parameters` section with a `vmSize` parameter and use it in the virtual machine resource.
C
Create a nested template to handle the virtual machine size selection.
D
Use a `variables` section to store the virtual machine size and reference it in the resource.
Correct Answer
B: Define a `parameters` section with a `vmSize` parameter and use it in the virtual machine resource.
Explanation
The correct answer is B. In ARM templates, you can define parameters for the virtual machine size using the `parameters` section. For example, you might have a parameter like `vmSize` that accepts values such as 'Standard_DS1_v2', 'Standard_DS2_v2', etc. This ensures flexibility in the deployment process, allowing users to specify the desired size at deployment time. Option A is incorrect because it suggests using a resource type directly, which does not allow for user input during deployment. Option C is incorrect because it suggests using a nested template, which is not necessary for specifying a simple parameter value. Option D is incorrect because it suggests using a variable, which cannot be used to pass values to resources during deployment.