Question 420
A Bicep deployment runs at resource-group scope rg-app, but it must read the ID of an existing storage account stshared located in another resource group rg-data in the same subscription. What must its Bicep resource reference include?
Explanation
Correct Answer
The `existing` modifier prevents redeployment, while `scope: resourceGroup('rg-data')` tells Bicep which resource group contains the referenced account. Both details matter.
Incorrect Answers
Without an explicit different scope, a resource declaration resolves relative to its deployment scope. Bicep does not automatically discover resources by name across resource groups.
Bicep supports a cross-resource-group existing-resource reference. Creating a second account produces the wrong identity and is unnecessary.
Conditionally creating a local resource does not bind a symbol to an existing account in rg-data. The location of the existing resource must be specified.