Exam AZ-400 All QuestionsBrowse all questions from this exam
Question 464

HOTSPOT

-

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.

    Correct Answer:

Discussion
Nian

'Consistent' is unclear - I guess they are asking for scope of uniqueness. Hence provided answer should be correct. planname -> subscription-id (same plan can hold apps from different res-groups) appname -> resourcegrp-id

chloaus

Provided answers are correct, https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/patterns-name-generation

60ties

U're right that 'Consistent' is unclear.

6c01613

I would select deployment name for app service and rg id for app instance. But to me this request of bring consistent is not clear. https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/patterns-name-generation Resources checked: https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-string#uniquestring

djhyfdgjk

Provided answers are wrong. Resource group id is a long string with slashes. It would be terrible idea to try to include it in the resource name. Same goes for Subscription id. What is the advantage of including thid long GUID into resource name ?? I would go with resource group name for both questions.

6c01613

UniqueString: The returned value is 13 characters long. https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-string#uniquestring

d526b99

ans is correct

husam421

param location string = resourceGroup().location param environmentName string param appServiceAppName string = 'app-contoso-${environmentName}-${uniqueString(resourceGroup().id)}' param appServicePlanName string = 'plan-contoso-${environmentName}-${uniqueString(resourceGroup().id)}' resource appServiceApp 'Microsoft.Web/sites@2022-09-01' = { name: appServiceAppName // ... } resource appServicePlan 'Microsoft.Web/serverfarms@2022-09-01' = { name: appServicePlanName // ... }

arr73

Answer should be "resourceGroup().id" in both slots. Reason: App name should be unique. The only valid option for this is "resourceGroup().id". And plan name should use the same string to be consistent. The link below is a reference for this solution in MS Documentation: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/patterns-name-generation#example-1-organizational-naming-convention

FeriAZ

By using (resourceGroupName), the parameter values for planname and appname will be populated with the actual name of the resource group where the deployment is taking place. param location string = resourceGroup().location param planname string = toLower('AppServicePlan-${uniqueString((resourceGroupName))}') param appname string = toLower('app-${uniqueString((resourceGroupName))}') resource webappplan 'Microsoft.Web/serverfarms@2022-09-01' = { name: planname location: location sku: { name: 'B1' tier: 'Basic' } }