1
1
@minLength (3 )
2
2
@maxLength (20 )
3
3
@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.' )
4
- param ResourcePrefix string
4
+ param Prefix string
5
+
5
6
6
7
@allowed ([
7
8
'australiaeast'
@@ -32,20 +33,8 @@ param ResourcePrefix string
32
33
param AiLocation string // The location used for all deployed resources. This location must be in the same region as the resource group.
33
34
param capacity int = 5
34
35
35
-
36
- @description ('A unique prefix for all resources in this deployment. This should be 3-10 characters long:' )
37
- //param environmentName string
38
- var randomString = substring (uniqueString (resourceGroup ().id ), 0 , 4 )
39
- @description ('The location used for all deployed resources' )
40
- // Generate a unique string based on the base name and a unique identifier
41
- //var uniqueSuffix = uniqueString(resourceGroup().id, ResourcePrefix)
42
-
43
- // Take the first 4 characters of the unique string to use as a suffix
44
- //var randomSuffix = substring(ResourcePrefix, 0, min(10, length(ResourcePrefix)))
45
-
46
- // Combine the base name with the random suffix
47
- var finalName = '${ResourcePrefix }-${randomString }'
48
-
36
+ var uniqueId = toLower (uniqueString (subscription ().id , Prefix , resourceGroup ().location ))
37
+ var ResourcePrefix = 'cm${padLeft (take (uniqueId , 12 ), 12 , '0' )}'
49
38
var imageVersion = 'rc1'
50
39
var location = resourceGroup ().location
51
40
var dblocation = resourceGroup ().location
@@ -56,11 +45,10 @@ var cosmosdbLogContainer = 'cmsalog'
56
45
var deploymentType = 'GlobalStandard'
57
46
var containerName = 'appstorage'
58
47
var llmModel = 'gpt-4o'
59
- var prefixCleaned = replace (toLower (finalName ), '-' , '' )
60
48
var storageSkuName = 'Standard_LRS'
61
- var storageContainerName = '${prefixCleaned }ctstor'
49
+ var storageContainerName = '${ResourcePrefix }ctstor'
62
50
var gptModelVersion = '2024-08-06'
63
- var aiServicesName = '${prefixCleaned }-aiservices'
51
+ var aiServicesName = '${ResourcePrefix }-aiservices'
64
52
65
53
66
54
@@ -116,7 +104,7 @@ resource aiServicesDeployments 'Microsoft.CognitiveServices/accounts/deployments
116
104
module managedIdentityModule 'deploy_managed_identity.bicep' = {
117
105
name : 'deploy_managed_identity'
118
106
params : {
119
- solutionName : prefixCleaned
107
+ solutionName : ResourcePrefix
120
108
solutionLocation : location
121
109
}
122
110
scope : resourceGroup (resourceGroup ().name )
@@ -127,7 +115,7 @@ module managedIdentityModule 'deploy_managed_identity.bicep' = {
127
115
module kvault 'deploy_keyvault.bicep' = {
128
116
name : 'deploy_keyvault'
129
117
params : {
130
- solutionName : prefixCleaned
118
+ solutionName : ResourcePrefix
131
119
solutionLocation : location
132
120
managedIdentityObjectId :managedIdentityModule .outputs .managedIdentityOutput .objectId
133
121
}
@@ -139,7 +127,7 @@ module kvault 'deploy_keyvault.bicep' = {
139
127
module aifoundry 'deploy_ai_foundry.bicep' = {
140
128
name : 'deploy_ai_foundry'
141
129
params : {
142
- solutionName : prefixCleaned
130
+ solutionName : ResourcePrefix
143
131
solutionLocation : AiLocation
144
132
keyVaultName : kvault .outputs .keyvaultName
145
133
gptModelName : llmModel
@@ -153,21 +141,21 @@ module aifoundry 'deploy_ai_foundry.bicep' = {
153
141
}
154
142
155
143
module containerAppsEnvironment 'br/public:avm/res/app/managed-environment:0.9.1' = {
156
- name : toLower ('${prefixCleaned }conAppsEnv' )
144
+ name : toLower ('${ResourcePrefix }conAppsEnv' )
157
145
params : {
158
146
logAnalyticsWorkspaceResourceId : aifoundry .outputs .logAnalyticsId
159
- name : toLower ('${prefixCleaned }manenv' )
147
+ name : toLower ('${ResourcePrefix }manenv' )
160
148
location : location
161
149
zoneRedundant : false
162
150
managedIdentities : managedIdentityModule
163
151
}
164
152
}
165
153
166
154
module databaseAccount 'br/public:avm/res/document-db/database-account:0.9.0' = {
167
- name : toLower ('${prefixCleaned }database' )
155
+ name : toLower ('${ResourcePrefix }database' )
168
156
params : {
169
157
// Required parameters
170
- name : toLower ('${prefixCleaned }databaseAccount' )
158
+ name : toLower ('${ResourcePrefix }databaseAccount' )
171
159
// Non-required parameters
172
160
enableAnalyticalStorage : true
173
161
location : dblocation
@@ -231,7 +219,7 @@ module databaseAccount 'br/public:avm/res/document-db/database-account:0.9.0' =
231
219
}
232
220
233
221
module containerAppFrontend 'br/public:avm/res/app/container-app:0.13.0' = {
234
- name : toLower ('${prefixCleaned }containerAppFrontend ' )
222
+ name : toLower ('${ResourcePrefix }Frontend ' )
235
223
params : {
236
224
managedIdentities : {
237
225
systemAssigned : true
@@ -261,15 +249,15 @@ module containerAppFrontend 'br/public:avm/res/app/container-app:0.13.0' = {
261
249
scaleMinReplicas : 1
262
250
scaleMaxReplicas : 1
263
251
environmentResourceId : containerAppsEnvironment .outputs .resourceId
264
- name : toLower ('${prefixCleaned }containerFrontend ' )
252
+ name : toLower ('${ResourcePrefix }Frontend ' )
265
253
// Non-required parameters
266
254
location : location
267
255
}
268
256
}
269
257
270
258
271
259
resource containerAppBackend 'Microsoft.App/containerApps@2023-05-01' = {
272
- name : toLower ('${prefixCleaned }containerBackend ' )
260
+ name : toLower ('${ResourcePrefix }Backend ' )
273
261
location : location
274
262
identity : {
275
263
type : 'SystemAssigned'
0 commit comments