nerdexam
Microsoft

AZ-400 · Question #511

Hotspot Question You have a management group that contains four Azure subscriptions. Each subscription contains four resource groups. You develop a new web app named App1. You plan to deploy an instan

The correct answer is param planname string = toLower('AppServicePlan-${uniqueString: (subscription().id)'; param appname string = toLower('app-${uniqueString: (resourceGroup().id)'. This hotspot question tests knowledge of Bicep template scoping, specifically how to use targetScope and subscription/resource group context functions to generate consistent names across subscriptions and resource groups.

Submitted by wei.xz· Mar 6, 2026Design and implement processes and communications

Question

Hotspot Question You have a management group that contains four Azure subscriptions. Each subscription contains four resource groups. You develop a new web app named App1. You plan to deploy an instance of App1 to each resource group. You need to create a Bicep template that will be used to deploy App1. The solution must meet the following requirements: - The name of each App1 instance must be consistent for each subscription and resource group. - The name of each App Service plan used to host App1 must be consistent. How should you complete the template? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point. Answer:

Exhibit

AZ-400 question #511 exhibit

Answer Area

  • param planname string = toLower('AppServicePlan-${uniqueString(subscription().id)'
    (deployment().name)'(resourceGroup().id)'('resourceGroupName')'(subscription().id)'
  • param appname string = toLower('app-${uniqueString(resourceGroup().id)'
    (deployment().name)'(resourceGroup().id)'('resourceGroupName')'(subscription().id)'

Explanation

This hotspot question tests knowledge of Bicep template scoping, specifically how to use targetScope and subscription/resource group context functions to generate consistent names across subscriptions and resource groups.

Approach. The template should use 'targetScope = resourceGroup' at the top (or leave it as default since resourceGroup is the default scope). To generate consistent names for App1 instances, you use 'resourceGroup().name' and 'subscription().subscriptionId' in the naming convention so each instance gets a unique but deterministic name tied to its resource group and subscription context. For the App Service plan name, a similar pattern using resourceGroup().name ensures consistency. The key functions are resourceGroup().name to get the current resource group name and subscription().subscriptionId to get the subscription ID, which together guarantee uniqueness and consistency when the same template is deployed across all 16 resource group targets (4 subscriptions × 4 resource groups).

Concept tested. Bicep template scoping and use of built-in functions like resourceGroup().name and subscription().subscriptionId to generate consistent, deterministic resource names when deploying the same template across multiple subscriptions and resource groups in a management group hierarchy.

Reference. https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions-resource#resourcegroup and https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deploy-to-management-group

Topics

#Bicep#Azure Resource Manager (ARM)#unique names#infrastructure as code

Community Discussion

No community discussion yet for this question.

Full AZ-400 Practice