@@ -2,22 +2,23 @@ metadata name = 'Modernize Your Code Solution Accelerator'
22metadata description = '''CSA CTO Gold Standard Solution Accelerator for Modernize Your Code.
33'''
44
5- @description ('Set to true if you want to deploy WAF-aligned infrastructure.' )
5+ @description ('Required. Set to true if you want to deploy WAF-aligned infrastructure.' )
66param useWafAlignedArchitecture bool
77
88@minLength (3 )
99@maxLength (16 )
1010@description ('Required. A unique application/solution name for all resources in this deployment. This should be 3-16 characters long.' )
11- param solutionName string
11+ param solutionName string = 'codemode'
1212
1313@maxLength (5 )
1414@description ('Optional. A unique token for the solution. This is used to ensure resource names are unique for global resources. Defaults to a 5-character substring of the unique string generated from the subscription ID, resource group name, and solution name.' )
1515param solutionUniqueToken string = substring (uniqueString (subscription ().id , resourceGroup ().name , solutionName ), 0 , 5 )
1616
1717@minLength (3 )
1818@metadata ({ azd : { type : 'location' } })
19- @description ('Optional. Azure region for all services. Defaults to the resource group location.' )
20- param location string = resourceGroup ().location
19+ @description ('Optional. Azure region for all services. Defaults to the resource group location. Regions are restricted to guarantee compatibility with paired regions and replica locations for data redundancy and failover scenarios.' )
20+ @allowed (['australiaeast' ,'brazilsouth' ,'canadacentral' ,'centralindia' ,'centralus' ,'eastasia' ,'eastus' ,'eastus2' ,'francecentral' ,'germanywestcentral' ,'japaneast' ,'japanwest' ,'koreacentral' ,'northeurope' ,'norwayeast' ,'southafricanorth' ,'southcentralus' ,'southeastasia' ,'swedencentral' ,'switzerlandnorth' ,'uaenorth' ,'uksouth' ,'westeurope' ,'westus2' ,'westus3' ])
21+ param location string
2122
2223@allowed ([
2324 'australiaeast'
@@ -53,7 +54,7 @@ param enableMonitoring bool = useWafAlignedArchitecture? true : false
5354param enableScaling bool = useWafAlignedArchitecture ? true : false
5455
5556@description ('Optional. Enable redundancy for applicable resources. Defaults to false.' )
56- param enableRedundancy bool = false
57+ param enableRedundancy bool = useWafAlignedArchitecture ? true : false
5758
5859@description ('Optional. The secondary location for the Cosmos DB account if redundancy is enabled.' )
5960param secondaryLocation string ?
@@ -74,8 +75,8 @@ param vmAdminUsername string?
7475//param vmAdminPassword string = newGuid()
7576param vmAdminPassword string ?
7677
77- @description ('Optional. Specifies the resource tags for all the resources. Tag "azd-env-name" is automatically added to all resources.' )
78- param tags object = {}
78+ @description ('Optional. The tags to apply to all deployed Azure resources.' )
79+ param tags resourceInput < 'Microsoft.Resources/resourceGroups@2025-04-01' >. tags = {}
7980
8081@description ('Optional. Enable/Disable usage telemetry for module.' )
8182param enableTelemetry bool = true
@@ -101,13 +102,6 @@ param azureExistingAIProjectResourceId string = ''
101102
102103param existingLogAnalyticsWorkspaceId string = ''
103104
104- var allTags = union (
105- {
106- 'azd-env-name' : solutionName
107- },
108- tags
109- )
110-
111105var resourcesName = toLower (trim (replace (
112106 replace (
113107 replace (replace (replace (replace ('${solutionName }${solutionUniqueToken }' , '-' , '' ), '_' , '' ), '.' , '' ), '/' , '' ),
@@ -132,14 +126,12 @@ var modelDeployment = {
132126 raiPolicyName : 'Microsoft.Default'
133127}
134128
135- var abbrs = loadJsonContent ('./abbreviations.json' )
136-
137129// ========== Resource Group Tag ========== //
138130resource resourceGroupTags 'Microsoft.Resources/tags@2021-04-01' = {
139131 name : 'default'
140132 properties : {
141133 tags : {
142- ...allTags
134+ ...tags
143135 TemplateName : 'Code Modernization'
144136 }
145137 }
@@ -167,12 +159,13 @@ resource avmTelemetry 'Microsoft.Resources/deployments@2024-03-01' = if (enableT
167159 }
168160}
169161
162+ var appIdentityName = 'id-${resourcesName }'
170163module appIdentity 'br/public:avm/res/managed-identity/user-assigned-identity:0.4.1' = {
171- name : take ('identity-app-${ resourcesName }-deployment ' , 64 )
164+ name : take ('avm.res.managed- identity.user-assigned-identity.${ appIdentityName } ' , 64 )
172165 params : {
173- name : '${ abbrs . security . managedIdentity }${ resourcesName }'
166+ name : appIdentityName
174167 location : location
175- tags : allTags
168+ tags : tags
176169 enableTelemetry : enableTelemetry
177170 }
178171}
@@ -188,16 +181,17 @@ resource existingLogAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces
188181 scope : resourceGroup (existingLawSubscription , existingLawResourceGroup )
189182}
190183
184+ var logAnalyticsWorkspaceResourceName = 'log-${resourcesName }'
191185// Deploy new Log Analytics workspace only if required and not using existing
192186module logAnalyticsWorkspace 'br/public:avm/res/operational-insights/workspace:0.11.2' = if ((enableMonitoring || enablePrivateNetworking ) && !useExistingLogAnalytics ) {
193- name : take ('log-analytics-${ resourcesName }-deployment ' , 64 )
187+ name : take ('avm.res.operational-insights.workspace.${ logAnalyticsWorkspaceResourceName } ' , 64 )
194188 params : {
195- name : '${ abbrs . managementGovernance . logAnalyticsWorkspace }${ resourcesName }'
189+ name : logAnalyticsWorkspaceResourceName
196190 location : location
197191 skuName : 'PerGB2018'
198192 dataRetention : 30
199193 diagnosticSettings : [{ useThisWorkspace : true }]
200- tags : allTags
194+ tags : tags
201195 enableTelemetry : enableTelemetry
202196 }
203197}
@@ -207,45 +201,45 @@ var logAnalyticsWorkspaceResourceId = useExistingLogAnalytics ? existingLogAnaly
207201var LogAnalyticsPrimarySharedKey string = useExistingLogAnalytics ? existingLogAnalyticsWorkspace .listKeys ().primarySharedKey : logAnalyticsWorkspace .outputs .primarySharedKey
208202var LogAnalyticsWorkspaceId = useExistingLogAnalytics ? existingLogAnalyticsWorkspace .properties .customerId : logAnalyticsWorkspace .outputs .logAnalyticsWorkspaceId
209203
204+ var applicationInsightsResourceName = 'appi-${resourcesName }'
210205module applicationInsights 'br/public:avm/res/insights/component:0.6.0' = if (enableMonitoring ) {
211- name : take ('app- insights-${ resourcesName }-deployment ' , 64 )
206+ name : take ('avm.res. insights.component.${ applicationInsightsResourceName } ' , 64 )
212207 params : {
213- name : '${ abbrs . managementGovernance . applicationInsights }${ resourcesName }'
208+ name : applicationInsightsResourceName
214209 location : location
215210 workspaceResourceId : logAnalyticsWorkspaceResourceId
216211 diagnosticSettings : [{ workspaceResourceId : logAnalyticsWorkspaceResourceId }]
217- tags : allTags
212+ tags : tags
218213 enableTelemetry : enableTelemetry
219214 }
220215}
221216
222-
223217module network 'modules/network.bicep' = if (enablePrivateNetworking ) {
224- name : take ('network- ${resourcesName }-deployment ' , 64 )
218+ name : take ('module. network. ${resourcesName }' , 64 )
225219 params : {
226220 resourcesName : resourcesName
227221 logAnalyticsWorkSpaceResourceId : logAnalyticsWorkspaceResourceId
228222 vmAdminUsername : vmAdminUsername ?? 'JumpboxAdminUser'
229223 vmAdminPassword : vmAdminPassword ?? 'JumpboxAdminP@ssw0rd1234!'
230224 vmSize : vmSize ?? 'Standard_DS2_v2' // Default VM size
231225 location : location
232- tags : allTags
226+ tags : tags
233227 enableTelemetry : enableTelemetry
234228 }
235229}
236230
237231module aiServices 'modules/ai-foundry/main.bicep' = {
238- name : take ('avm.res.cognitive-services.account .${resourcesName }' , 64 )
232+ name : take ('modules.ai-foundry .${resourcesName }' , 64 )
239233 #disable-next-line no-unnecessary-dependson
240234 dependsOn : [logAnalyticsWorkspace , network ] // required due to optional flags that could change dependency
241235 params : {
242- name : '${ abbrs . ai . aiFoundry } ${resourcesName }'
236+ name : 'aif- ${resourcesName }'
243237 location : aiDeploymentsLocation
244238 sku : 'S0'
245239 kind : 'AIServices'
246240 deployments : [ modelDeployment ]
247- projectName : '${ abbrs . ai . aiFoundryProject } ${resourcesName }'
248- projectDescription : '${ abbrs . ai . aiFoundryProject } ${resourcesName }'
241+ projectName : 'aifp- ${resourcesName }'
242+ projectDescription : 'aifp- ${resourcesName }'
249243 logAnalyticsWorkspaceResourceId : enableMonitoring ? logAnalyticsWorkspaceResourceId : ''
250244 privateNetworking : enablePrivateNetworking
251245 ? {
@@ -286,21 +280,21 @@ module aiServices 'modules/ai-foundry/main.bicep' = {
286280 roleDefinitionIdOrName : '53ca6127-db72-4b80-b1b0-d745d6d5456d' // Azure AI User
287281 }
288282 ]
289- tags : allTags
283+ tags : tags
290284 enableTelemetry : enableTelemetry
291285 }
292286}
293287
294288var appStorageContainerName = 'appstorage'
295289
296290module storageAccount 'modules/storageAccount.bicep' = {
297- name : take ('storage-account- ${resourcesName }-deployment ' , 64 )
291+ name : take ('module.storageAccount. ${resourcesName }' , 64 )
298292 #disable-next-line no-unnecessary-dependson
299293 dependsOn : [logAnalyticsWorkspace , network ] // required due to optional flags that could change dependency
300294 params : {
301- name : take ('${ abbrs . storage . storageAccount } ${resourcesName }' , 24 )
295+ name : take ('st ${resourcesName }' , 24 )
302296 location : location
303- tags : allTags
297+ tags : tags
304298 skuName : enableRedundancy ? 'Standard_GZRS' : 'Standard_LRS'
305299 logAnalyticsWorkspaceResourceId : enableMonitoring ? logAnalyticsWorkspaceResourceId : ''
306300 privateNetworking : enablePrivateNetworking
@@ -329,11 +323,11 @@ module storageAccount 'modules/storageAccount.bicep' = {
329323}
330324
331325module keyVault 'modules/keyVault.bicep' = {
332- name : take ('keyvault- ${resourcesName }-deployment ' , 64 )
326+ name : take ('module. keyvault. ${resourcesName }' , 64 )
333327 #disable-next-line no-unnecessary-dependson
334328 dependsOn : [logAnalyticsWorkspace , network ] // required due to optional flags that could change dependency
335329 params : {
336- name : take ('${ abbrs . security . keyVault } ${resourcesName }' , 24 )
330+ name : take ('kv- ${resourcesName }' , 24 )
337331 location : location
338332 sku : 'standard'
339333 logAnalyticsWorkspaceResourceId : enableMonitoring ? logAnalyticsWorkspaceResourceId : ''
@@ -350,17 +344,17 @@ module keyVault 'modules/keyVault.bicep' = {
350344 roleDefinitionIdOrName : 'Key Vault Administrator'
351345 }
352346 ]
353- tags : allTags
347+ tags : tags
354348 enableTelemetry : enableTelemetry
355349 }
356350}
357351
358352module cosmosDb 'modules/cosmosDb.bicep' = {
359- name : take ('cosmos- ${resourcesName }-deployment ' , 64 )
353+ name : take ('module. cosmos. ${resourcesName }' , 64 )
360354 #disable-next-line no-unnecessary-dependson
361355 dependsOn : [logAnalyticsWorkspace , network ] // required due to optional flags that could change dependency
362356 params : {
363- name : take ('${ abbrs . databases . cosmosDBDatabase } ${resourcesName }' , 44 )
357+ name : take ('cosmos- ${resourcesName }' , 44 )
364358 location : location
365359 dataAccessIdentityPrincipalId : appIdentity .outputs .principalId
366360 logAnalyticsWorkspaceResourceId : enableMonitoring ? logAnalyticsWorkspaceResourceId : ''
@@ -372,15 +366,15 @@ module cosmosDb 'modules/cosmosDb.bicep' = {
372366 subnetResourceId : network .outputs .subnetPrivateEndpointsResourceId
373367 }
374368 : null
375- tags : allTags
369+ tags : tags
376370 enableTelemetry : enableTelemetry
377371 }
378372}
379373
380- var containerAppsEnvironmentName = '${ abbrs . containers . containerAppsEnvironment } ${resourcesName }'
374+ var containerAppsEnvironmentName = 'cae- ${resourcesName }'
381375
382376module containerAppsEnvironment 'br/public:avm/res/app/managed-environment:0.11.2' = {
383- name : take ('container-env-${ resourcesName }-deployment ' , 64 )
377+ name : take ('avm.res.app.managed-environment.${ containerAppsEnvironmentName } ' , 64 )
384378 #disable-next-line no-unnecessary-dependson
385379 dependsOn : [applicationInsights , logAnalyticsWorkspace , network ] // required due to optional flags that could change dependency
386380 params : {
@@ -414,17 +408,18 @@ module containerAppsEnvironment 'br/public:avm/res/app/managed-environment:0.11.
414408 }
415409 ]
416410 : []
417- tags : allTags
411+ tags : tags
418412 enableTelemetry : enableTelemetry
419413 }
420414}
421415
416+ var containerAppBackendName = 'ca-${resourcesName }-backend'
422417module containerAppBackend 'br/public:avm/res/app/container-app:0.17.0' = {
423- name : take ('container-app-backend-${ resourcesName }-deployment ' , 64 )
418+ name : take ('avm.res.app. container-app.${ containerAppBackendName } ' , 64 )
424419 #disable-next-line no-unnecessary-dependson
425420 dependsOn : [applicationInsights ] // required due to optional flags that could change dependency
426421 params : {
427- name : take ( '${ abbrs . containers . containerApp }backend-${ resourcesName }' , 32 )
422+ name : containerAppBackendName
428423 location : location
429424 environmentResourceId : containerAppsEnvironment .outputs .resourceId
430425 managedIdentities : {
@@ -585,15 +580,16 @@ module containerAppBackend 'br/public:avm/res/app/container-app:0.17.0' = {
585580 ]
586581 : []
587582 }
588- tags : allTags
583+ tags : tags
589584 enableTelemetry : enableTelemetry
590585 }
591586}
592587
588+ var containerAppFrontendName = 'ca-${resourcesName }-frontend'
593589module containerAppFrontend 'br/public:avm/res/app/container-app:0.17.0' = {
594- name : take ('container-app-frontend-${ resourcesName }-deployment ' , 64 )
590+ name : take ('avm.res.app. container-app.${ containerAppFrontendName } ' , 64 )
595591 params : {
596- name : take ( '${ abbrs . containers . containerApp }frontend-${ resourcesName }' , 32 )
592+ name : containerAppFrontendName
597593 location : location
598594 environmentResourceId : containerAppsEnvironment .outputs .resourceId
599595 managedIdentities : {
@@ -639,7 +635,7 @@ module containerAppFrontend 'br/public:avm/res/app/container-app:0.17.0' = {
639635 ]
640636 : []
641637 }
642- tags : allTags
638+ tags : tags
643639 enableTelemetry : enableTelemetry
644640 }
645641}
0 commit comments