11@minLength (3 )
2-
3- @maxLength (10 )
4- @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.' )
5- param ResourcePrefix string
2+ @description ('Prefix for all resources created by this template. This should be 3-20 characters long. If your provide a prefix longer than 20 characters, it will be truncated to 20 characters.' )
3+ param Prefix string
64var abbrs = loadJsonContent ('./abbreviations.json' )
7-
5+ var safePrefix = length ( Prefix ) > 20 ? substring ( Prefix , 0 , 20 ) : Prefix
86
97@allowed ([
108 'australiaeast'
@@ -49,11 +47,9 @@ var deploymentType = 'GlobalStandard'
4947var containerName = 'appstorage'
5048var llmModel = 'gpt-4o'
5149var storageSkuName = 'Standard_LRS'
52-
53- var storageContainerName = '${abbrs .storage .storageAccount }${prefixCleaned }'
50+ var storageContainerName = replace (replace (replace (replace ('${ResourcePrefix }cast' , '-' , '' ), '_' , '' ), '.' , '' ),'/' , '' )
5451var gptModelVersion = '2024-08-06'
55- var aiServicesName = '${abbrs .ai .aiServices }${prefixCleaned }'
56-
52+ var azureAiServicesName = '${abbrs .ai .aiServices }${ResourcePrefix }'
5753
5854
5955
@@ -78,12 +74,7 @@ resource azureAiServices 'Microsoft.CognitiveServices/accounts@2024-04-01-previe
7874 }
7975 kind : 'AIServices'
8076 properties : {
81-
82- customSubDomainName : aiServicesName
83- apiProperties : {
84- // statisticsEnabled: false
85- }
86-
77+ customSubDomainName : azureAiServicesName
8778 }
8879}
8980
@@ -111,10 +102,8 @@ resource azureAiServicesDeployments 'Microsoft.CognitiveServices/accounts/deploy
111102module managedIdentityModule 'deploy_managed_identity.bicep' = {
112103 name : 'deploy_managed_identity'
113104 params : {
114-
115- miName :'${abbrs .security .managedIdentity }${prefixCleaned }'
116- solutionName : prefixCleaned
117-
105+ miName :'${abbrs .security .managedIdentity }${ResourcePrefix }'
106+ solutionName : ResourcePrefix
118107 solutionLocation : location
119108 }
120109 scope : resourceGroup (resourceGroup ().name )
@@ -125,10 +114,8 @@ module managedIdentityModule 'deploy_managed_identity.bicep' = {
125114module kvault 'deploy_keyvault.bicep' = {
126115 name : 'deploy_keyvault'
127116 params : {
128-
129- keyvaultName : '${abbrs .security .keyVault }${prefixCleaned }'
130- solutionName : prefixCleaned
131-
117+ keyvaultName : '${abbrs .security .keyVault }${ResourcePrefix }'
118+ solutionName : ResourcePrefix
132119 solutionLocation : location
133120 managedIdentityObjectId :managedIdentityModule .outputs .managedIdentityOutput .objectId
134121 }
@@ -165,12 +152,10 @@ module containerAppsEnvironment 'br/public:avm/res/app/managed-environment:0.9.1
165152}
166153
167154module databaseAccount 'br/public:avm/res/document-db/database-account:0.9.0' = {
168- name : toLower ('${ResourcePrefix }cosmos ' )
155+ name : toLower ('${abbrs . databases . cosmosDBDatabase }${ ResourcePrefix }databaseAccount ' )
169156 params : {
170157 // Required parameters
171-
172- name : toLower ('${abbrs .databases .cosmosDBDatabase }${prefixCleaned }databaseAccount' )
173-
158+ name : toLower ('${abbrs .databases .cosmosDBDatabase }${ResourcePrefix }databaseAccount' )
174159 // Non-required parameters
175160 enableAnalyticalStorage : true
176161 location : dblocation
@@ -234,9 +219,7 @@ module databaseAccount 'br/public:avm/res/document-db/database-account:0.9.0' =
234219}
235220
236221module containerAppFrontend 'br/public:avm/res/app/container-app:0.13.0' = {
237-
238- name : toLower ('${abbrs .containers .containerApp }${prefixCleaned }containerAppFrontend' )
239-
222+ name : toLower ('${abbrs .containers .containerApp }${ResourcePrefix }containerAppFrontend' )
240223 params : {
241224 managedIdentities : {
242225 systemAssigned : true
@@ -266,19 +249,15 @@ module containerAppFrontend 'br/public:avm/res/app/container-app:0.13.0' = {
266249 scaleMinReplicas : 1
267250 scaleMaxReplicas : 1
268251 environmentResourceId : containerAppsEnvironment .outputs .resourceId
269-
270- name : toLower ('${abbrs .containers .containerApp }${prefixCleaned }containerFrontend' )
271-
252+ name : toLower ('${abbrs .containers .containerApp }${ResourcePrefix }Frontend' )
272253 // Non-required parameters
273254 location : location
274255 }
275256}
276257
277258
278259resource containerAppBackend 'Microsoft.App/containerApps@2023-05-01' = {
279-
280- name : toLower ('${abbrs .containers .containerApp }${prefixCleaned }containerBackend' )
281-
260+ name : toLower ('${abbrs .containers .containerApp }${ResourcePrefix }Backend' )
282261 location : location
283262 identity : {
284263 type : 'SystemAssigned'
@@ -475,7 +454,7 @@ resource containers 'Microsoft.Storage/storageAccounts/blobServices/containers@2
475454}]
476455
477456resource aiHubProject 'Microsoft.MachineLearningServices/workspaces@2024-01-01-preview' existing = {
478- name : '${ResourcePrefix }-prj ' // aiProjectName must be calculated - available at main start.
457+ name : '${abbrs . ai . aiHubProject }${ ResourcePrefix }' // aiProjectName must be calculated - available at main start.
479458}
480459
481460resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
0 commit comments