AZ-104 · Question #621
AZ-104 Question #621: Real Exam Question with Answer & Explanation
The deployment uses an ARM template with a copy loop to create four storage accounts in the same region as the resource group (East US), with names appended by a zero-based index.
Question
Hotspot Question You have an Azure subscription. You create the following file named Deploy.json. You connect to the subscription and run the following commands. For each of the following statements, select Yes if the statement is true. Otherwise, select No. NOTE: Each correct selection is worth one point. Answer:
Options
- __typehotspot
- variantyes_no
Explanation
The deployment uses an ARM template with a copy loop to create four storage accounts in the same region as the resource group (East US), with names appended by a zero-based index.
Approach. 1. 'The commands will create four new resources': Yes. The ARM template contains a 'copy' block with 'count': 4, which instructs the Azure Resource Manager to deploy four instances of the storage account. 2. 'The commands will create storage accounts in the West US Azure region': No. The template inherits the location from the resource group via '[resourceGroup().location]'. Because the PowerShell command explicitly created the resource group in 'East US', the storage accounts will also be in East US. 3. 'The first storage account that is created will have a suffix of 0': Yes. The resource name is defined by '[concat('storage', copyIndex())]'. In ARM templates, the 'copyIndex()' function is zero-based by default. Therefore, the first iteration returns 0, resulting in the name 'storage0'.
Common mistakes.
- common_mistake. A common error is assuming that
copyIndex()starts at 1 instead of 0 (which would make the first suffix 1), or overlooking the dynamic[resourceGroup().location]function and guessing the region incorrectly.
Concept tested. ARM Template Resource Iteration (copy loop), ARM Template Functions (copyIndex, resourceGroup), and PowerShell AzureRM Deployment
Reference. https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/copy-resources
Topics
Community Discussion
No community discussion yet for this question.