Skip to content

Commit ef3c94d

Browse files
committed
templet updates
1 parent b1f1ade commit ef3c94d

2 files changed

Lines changed: 12 additions & 24 deletions

File tree

infra/main.bicep

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ var gptModelVersion = '2024-08-06'
6666
var storageNameCleanedContainer = replace(storageContainerName, '-', '')
6767
var aiServicesName = '${prefixCleaned}-aiservices'
6868

69-
var imageName = 'cmsacontainerreg.azurecr.io/cmsabackend:${frontEndVersion}'
70-
7169

7270

7371
var aiModelDeployments = [
@@ -167,12 +165,10 @@ module containerAppsEnvironment 'br/public:avm/res/app/managed-environment:0.9.1
167165
zoneRedundant: false
168166
managedIdentities: managedIdentityModule
169167
}
170-
scope: resourceGroup(resourceGroup().name)
171168
}
172169

173170
module databaseAccount 'br/public:avm/res/document-db/database-account:0.9.0' = {
174171
name: toLower('${prefixCleaned}database')
175-
scope: resourceGroup(resourceGroup().name)
176172
params: {
177173
// Required parameters
178174
name: toLower('${prefixCleaned}databaseAccount')
@@ -240,7 +236,6 @@ module databaseAccount 'br/public:avm/res/document-db/database-account:0.9.0' =
240236

241237
module containerAppFrontend 'br/public:avm/res/app/container-app:0.13.0' = {
242238
name: toLower('${prefixCleaned}containerAppFrontend')
243-
scope: resourceGroup(resourceGroup().name)
244239
params: {
245240
managedIdentities: {
246241
systemAssigned: true
@@ -257,7 +252,7 @@ module containerAppFrontend 'br/public:avm/res/app/container-app:0.13.0' = {
257252
value: 'https://${containerAppBackend.properties.configuration.ingress.fqdn}'
258253
}
259254
]
260-
image: imageName
255+
image: 'cmsacontainerreg.azurecr.io/cmsafrontend:${frontEndVersion}'
261256
name: 'cmsafrontend'
262257
resources: {
263258
cpu: '1'
@@ -448,7 +443,6 @@ var containerNames = [
448443
// Create a blob container resource for each container name.
449444
resource containers 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-08-01' = [for containerName in containerNames: {
450445
name: '${storageNameCleanedContainer}/default/${containerName}'
451-
452446
properties: {
453447
publicAccess: 'None'
454448
}
@@ -464,7 +458,6 @@ var cosmosAssignCli = 'az cosmosdb sql role assignment create --resource-group
464458

465459
module deploymentScriptCLI 'br/public:avm/res/resources/deployment-script:0.5.1' = {
466460
name: 'deploymentScriptCLI'
467-
scope: resourceGroup(resourceGroup().name)
468461
params: {
469462
// Required parameters
470463
kind: 'AzureCLI'

infra/main.json

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"_generator": {
66
"name": "bicep",
77
"version": "0.33.93.31351",
8-
"templateHash": "17542743656550028202"
8+
"templateHash": "17465000776634471517"
99
}
1010
},
1111
"parameters": {
@@ -67,7 +67,7 @@
6767
}
6868
},
6969
"variables": {
70-
"randomSuffix": "[substring(parameters('environmentName'), 3, 10)]",
70+
"randomSuffix": "[substring(parameters('environmentName'), 0, min(10, length(parameters('environmentName'))))]",
7171
"finalName": "[format('{0}-{1}', parameters('ResourcePrefix'), variables('randomSuffix'))]",
7272
"backEndVersion": "[if(parameters('Authorization'), 'rcauth', 'rcnoauth')]",
7373
"frontEndVersion": "[if(parameters('Authorization'), 'rcauth', 'rcnoauth')]",
@@ -86,7 +86,6 @@
8686
"gptModelVersion": "2024-08-06",
8787
"storageNameCleanedContainer": "[replace(variables('storageContainerName'), '-', '')]",
8888
"aiServicesName": "[format('{0}-aiservices', variables('prefixCleaned'))]",
89-
"imageName": "[format('cmsacontainerreg.azurecr.io/cmsabackend:{0}', variables('frontEndVersion'))]",
9089
"aiModelDeployments": [
9190
{
9291
"name": "[variables('llmModel')]",
@@ -156,7 +155,7 @@
156155
"type": "SystemAssigned"
157156
},
158157
"properties": {
159-
"managedEnvironmentId": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned')))), '2022-09-01').outputs.resourceId.value]",
158+
"managedEnvironmentId": "[reference(resourceId('Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned')))), '2022-09-01').outputs.resourceId.value]",
160159
"configuration": {
161160
"ingress": {
162161
"external": true,
@@ -175,7 +174,7 @@
175174
"env": [
176175
{
177176
"name": "COSMOSDB_ENDPOINT",
178-
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned')))), '2022-09-01').outputs.endpoint.value]"
177+
"value": "[reference(resourceId('Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned')))), '2022-09-01').outputs.endpoint.value]"
179178
},
180179
{
181180
"name": "COSMOSDB_DATABASE",
@@ -244,8 +243,8 @@
244243
},
245244
"dependsOn": [
246245
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry')]",
247-
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned'))))]",
248-
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned'))))]",
246+
"[resourceId('Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned'))))]",
247+
"[resourceId('Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned'))))]",
249248
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageNameCleanedContainer'))]"
250249
]
251250
},
@@ -969,7 +968,6 @@
969968
"type": "Microsoft.Resources/deployments",
970969
"apiVersion": "2022-09-01",
971970
"name": "[toLower(format('{0}conAppsEnv', variables('prefixCleaned')))]",
972-
"resourceGroup": "[resourceGroup().name]",
973971
"properties": {
974972
"expressionEvaluationOptions": {
975973
"scope": "inner"
@@ -1589,7 +1587,6 @@
15891587
"type": "Microsoft.Resources/deployments",
15901588
"apiVersion": "2022-09-01",
15911589
"name": "[toLower(format('{0}database', variables('prefixCleaned')))]",
1592-
"resourceGroup": "[resourceGroup().name]",
15931590
"properties": {
15941591
"expressionEvaluationOptions": {
15951592
"scope": "inner"
@@ -5406,7 +5403,6 @@
54065403
"type": "Microsoft.Resources/deployments",
54075404
"apiVersion": "2022-09-01",
54085405
"name": "[toLower(format('{0}containerAppFrontend', variables('prefixCleaned')))]",
5409-
"resourceGroup": "[resourceGroup().name]",
54105406
"properties": {
54115407
"expressionEvaluationOptions": {
54125408
"scope": "inner"
@@ -5430,7 +5426,7 @@
54305426
"value": "[format('https://{0}', reference(resourceId('Microsoft.App/containerApps', toLower(format('{0}containerBackend', variables('prefixCleaned')))), '2023-05-01').configuration.ingress.fqdn)]"
54315427
}
54325428
],
5433-
"image": "[variables('imageName')]",
5429+
"image": "[format('cmsacontainerreg.azurecr.io/cmsafrontend:{0}', variables('frontEndVersion'))]",
54345430
"name": "cmsafrontend",
54355431
"resources": {
54365432
"cpu": "1",
@@ -5452,7 +5448,7 @@
54525448
"value": 1
54535449
},
54545450
"environmentResourceId": {
5455-
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned')))), '2022-09-01').outputs.resourceId.value]"
5451+
"value": "[reference(resourceId('Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned')))), '2022-09-01').outputs.resourceId.value]"
54565452
},
54575453
"name": {
54585454
"value": "[toLower(format('{0}containerFrontend', variables('prefixCleaned')))]"
@@ -6628,15 +6624,14 @@
66286624
},
66296625
"dependsOn": [
66306626
"[resourceId('Microsoft.App/containerApps', toLower(format('{0}containerBackend', variables('prefixCleaned'))))]",
6631-
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned'))))]",
6627+
"[resourceId('Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned'))))]",
66326628
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_managed_identity')]"
66336629
]
66346630
},
66356631
{
66366632
"type": "Microsoft.Resources/deployments",
66376633
"apiVersion": "2022-09-01",
66386634
"name": "deploymentScriptCLI",
6639-
"resourceGroup": "[resourceGroup().name]",
66406635
"properties": {
66416636
"expressionEvaluationOptions": {
66426637
"scope": "inner"
@@ -6663,7 +6658,7 @@
66636658
}
66646659
},
66656660
"scriptContent": {
6666-
"value": "[format('az cosmosdb sql role assignment create --resource-group \"{0}\" --account-name \"{1}\" --role-definition-id \"{2}\" --scope \"{3}\" --principal-id \"{4}\"', resourceGroup().name, reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned')))), '2022-09-01').outputs.name.value, resourceId('Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions', split(format('{0}/00000000-0000-0000-0000-000000000002', toLower(format('{0}database', variables('prefixCleaned')))), '/')[0], split(format('{0}/00000000-0000-0000-0000-000000000002', toLower(format('{0}database', variables('prefixCleaned')))), '/')[1]), reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned')))), '2022-09-01').outputs.resourceId.value, reference(resourceId('Microsoft.App/containerApps', toLower(format('{0}containerBackend', variables('prefixCleaned')))), '2023-05-01', 'full').identity.principalId)]"
6661+
"value": "[format('az cosmosdb sql role assignment create --resource-group \"{0}\" --account-name \"{1}\" --role-definition-id \"{2}\" --scope \"{3}\" --principal-id \"{4}\"', resourceGroup().name, reference(resourceId('Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned')))), '2022-09-01').outputs.name.value, resourceId('Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions', split(format('{0}/00000000-0000-0000-0000-000000000002', toLower(format('{0}database', variables('prefixCleaned')))), '/')[0], split(format('{0}/00000000-0000-0000-0000-000000000002', toLower(format('{0}database', variables('prefixCleaned')))), '/')[1]), reference(resourceId('Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned')))), '2022-09-01').outputs.resourceId.value, reference(resourceId('Microsoft.App/containerApps', toLower(format('{0}containerBackend', variables('prefixCleaned')))), '2023-05-01', 'full').identity.principalId)]"
66676662
}
66686663
},
66696664
"template": {
@@ -7193,7 +7188,7 @@
71937188
},
71947189
"dependsOn": [
71957190
"[resourceId('Microsoft.App/containerApps', toLower(format('{0}containerBackend', variables('prefixCleaned'))))]",
7196-
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned'))))]",
7191+
"[resourceId('Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned'))))]",
71977192
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_managed_identity')]"
71987193
]
71997194
}

0 commit comments

Comments
 (0)