@@ -32,8 +32,11 @@ param azureOpenAILocation string = 'eastus2' // The location used for all deploy
3232
3333@minLength (3 )
3434@maxLength (20 )
35- @description ('Prefix for all resources created by this template. This prefix will be used to create unique names for all resources. The prefix must be unique within the resource group.' )
36- param prefix string = toLower (uniqueString (subscription ().id , resourceGroup ().location ))
35+ @description ('A unique prefix for all resources in this deployment. This should be 3-20 characters long:' )
36+ param environmentName string
37+
38+ var uniqueId = toLower (uniqueString (subscription ().id , environmentName , resourceGroup ().location ))
39+ var solutionPrefix = 'ma${padLeft (take (uniqueId , 12 ), 12 , '0' )}'
3740
3841@description ('Tags to apply to all deployed resources' )
3942param tags object = {}
@@ -59,7 +62,7 @@ param resourceSize {
5962param capacity int = 140
6063
6164var modelVersion = '2024-08-06'
62- var aiServicesName = '${prefix }-aiservices'
65+ var aiServicesName = '${solutionPrefix }-aiservices'
6366var deploymentType = 'GlobalStandard'
6467var gptModelVersion = 'gpt-4o'
6568var appVersion = 'fnd01'
@@ -70,7 +73,7 @@ var dockerRegistryUrl = 'https://${resgistryName}.azurecr.io'
7073var backendDockerImageURL = '${resgistryName }.azurecr.io/macaebackend:${appVersion }'
7174var frontendDockerImageURL = '${resgistryName }.azurecr.io/macaefrontend:${appVersion }'
7275
73- var uniqueNameFormat = '${prefix }-{0}-${uniqueString (resourceGroup ().id , prefix )}'
76+ var uniqueNameFormat = '${solutionPrefix }-{0}-${uniqueString (resourceGroup ().id , solutionPrefix )}'
7477var aoaiApiVersion = '2025-01-01-preview'
7578
7679resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
@@ -146,7 +149,7 @@ resource aiServicesDeployments 'Microsoft.CognitiveServices/accounts/deployments
146149module kvault 'deploy_keyvault.bicep' = {
147150 name : 'deploy_keyvault'
148151 params : {
149- solutionName : prefix
152+ solutionName : solutionPrefix
150153 solutionLocation : location
151154 managedIdentityObjectId : managedIdentityModule .outputs .managedIdentityOutput .objectId
152155 }
@@ -160,7 +163,7 @@ module kvault 'deploy_keyvault.bicep' = {
160163module aifoundry 'deploy_ai_foundry.bicep' = {
161164 name : 'deploy_ai_foundry'
162165 params : {
163- solutionName : prefix
166+ solutionName : solutionPrefix
164167 solutionLocation : azureOpenAILocation
165168 keyVaultName : kvault .outputs .keyvaultName
166169 gptModelName : gptModelVersion
@@ -276,7 +279,7 @@ resource acaCosomsRoleAssignment 'Microsoft.DocumentDB/databaseAccounts/sqlRoleA
276279
277280@description ('' )
278281resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
279- name : '${prefix }-backend'
282+ name : '${solutionPrefix }-backend'
280283 location : location
281284 tags : tags
282285 identity : {
@@ -445,7 +448,7 @@ resource frontendAppService 'Microsoft.Web/sites@2021-02-01' = {
445448}
446449
447450resource aiHubProject 'Microsoft.MachineLearningServices/workspaces@2024-01-01-preview' existing = {
448- name : '${prefix }-aiproject' // aiProjectName must be calculated - available at main start.
451+ name : '${solutionPrefix }-aiproject' // aiProjectName must be calculated - available at main start.
449452}
450453
451454resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
@@ -466,7 +469,7 @@ var cosmosAssignCli = 'az cosmosdb sql role assignment create --resource-group "
466469module managedIdentityModule 'deploy_managed_identity.bicep' = {
467470 name : 'deploy_managed_identity'
468471 params : {
469- solutionName : prefix
472+ solutionName : solutionPrefix
470473 //solutionLocation: location
471474 managedIdentityId : pullIdentity .id
472475 managedIdentityPropPrin : pullIdentity .properties .principalId
0 commit comments