az-104 Practice Question 1722
Exam: az-104
Domain: Deploy and manage Azure compute resources
Topic: Automate deployment of resources by using templates
Difficulty: medium
A company wants to deploy a multi-tier application using ARM templates. The application consists of a web tier and a database tier, each requiring its own virtual network segment. How should you design the ARM template to ensure both tiers are deployed in separate subnets within the same virtual network?
Answer Options
A
Create a single subnet resource for both the web and database tiers.
B
Define a virtual network resource and two separate subnet resources within the template.
C
Use a single virtual network resource without defining any subnets.
D
Create a nested template for each tier and link them to a parent template.
Correct Answer
B: Define a virtual network resource and two separate subnet resources within the template.
Explanation
The correct answer is B. To deploy the web and database tiers in separate subnets within the same virtual network, you should create two subnet resources within the virtual network resource in your ARM template. Use the `resources` section to define each subnet with a unique name and properties such as `addressPrefix`. Ensure that the virtual network and subnets are correctly linked together. Option A is incorrect because it suggests using a single subnet for both tiers, which would violate the requirement for separation. Option C is incorrect because it implies using a single virtual network resource without defining subnets, which is not sufficient for the given scenario. Option D is incorrect because it suggests using nested templates, which is unnecessary for this straightforward deployment scenario.