AZ-400 Exam QuestionsBrowse all questions from this exam

AZ-400 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.

Show Answer
Correct Answer:

Discussion

7 comments
Sign in to comment
Nian
Mar 17, 2024

'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
Apr 28, 2024

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

60ties
Jul 16, 2024

U're right that 'Consistent' is unclear.

d526b99
Jan 27, 2024

ans is correct

djhyfdgjk
Feb 1, 2024

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
Feb 8, 2024

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

6c01613
Feb 8, 2024

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

FeriAZ
Mar 20, 2024

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' } }

arr73
May 26, 2024

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

husam421
Jul 10, 2024

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 // ... }