Skip to content

Commit bd3746a

Browse files
Keep only one app insights
1 parent f150cbd commit bd3746a

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

infra/deploy_ai_foundry.bicep

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,3 +658,5 @@ output aiSearchId string = aiSearch.id
658658
output aiSearchTarget string = 'https://${aiSearch.name}.search.windows.net'
659659
output aiSearchService string = aiSearch.name
660660
output aiProjectName string = aiHubProject.name
661+
662+
output applicationInsightsId string = applicationInsights.id

infra/deploy_app_service.bicep

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ param AZURE_COSMOSDB_DATABASE string = ''
6464
param AZURE_COSMOSDB_ENABLE_FEEDBACK string = 'True'
6565

6666
param imageTag string
67+
param applicationInsightsId string
6768
// var WebAppImageName = 'DOCKER|byoaiacontainer.azurecr.io/byoaia-app:latest'
6869

6970
// var WebAppImageName = 'DOCKER|ncwaappcontainerreg1.azurecr.io/ncqaappimage:v1.0.0'
@@ -158,7 +159,7 @@ resource Website 'Microsoft.Web/sites@2020-06-01' = {
158159
appSettings: [
159160
{
160161
name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
161-
value: reference(ApplicationInsights.id, '2015-05-01').InstrumentationKey
162+
value: reference(applicationInsightsId, '2015-05-01').InstrumentationKey
162163
}
163164
{
164165
name: 'AZURE_OPENAI_API_VERSION'
@@ -228,17 +229,17 @@ resource Website 'Microsoft.Web/sites@2020-06-01' = {
228229
dependsOn: [HostingPlan]
229230
}
230231

231-
resource ApplicationInsights 'Microsoft.Insights/components@2020-02-02' = {
232-
name: ApplicationInsightsName
233-
location: resourceGroup().location
234-
tags: {
235-
'hidden-link:${resourceId('Microsoft.Web/sites',ApplicationInsightsName)}': 'Resource'
236-
}
237-
properties: {
238-
Application_Type: 'web'
239-
}
240-
kind: 'web'
241-
}
232+
// resource ApplicationInsights 'Microsoft.Insights/components@2020-02-02' = {
233+
// name: ApplicationInsightsName
234+
// location: resourceGroup().location
235+
// tags: {
236+
// 'hidden-link:${resourceId('Microsoft.Web/sites',ApplicationInsightsName)}': 'Resource'
237+
// }
238+
// properties: {
239+
// Application_Type: 'web'
240+
// }
241+
// kind: 'web'
242+
// }
242243

243244
resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2022-08-15' existing = {
244245
name: AZURE_COSMOSDB_ACCOUNT

infra/main.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ module appserviceModule 'deploy_app_service.bicep' = {
235235
name: 'deploy_app_service'
236236
params: {
237237
imageTag: imageTag
238+
applicationInsightsId: aifoundry.outputs.applicationInsightsId
238239
// identity:managedIdentityModule.outputs.managedIdentityOutput.id
239240
solutionName: solutionPrefix
240241
// solutionLocation: solutionLocation

infra/main.json

Lines changed: 14 additions & 18 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": "10535791601593705798"
8+
"templateHash": "3380130655713808317"
99
}
1010
},
1111
"parameters": {
@@ -366,7 +366,7 @@
366366
"_generator": {
367367
"name": "bicep",
368368
"version": "0.33.93.31351",
369-
"templateHash": "7803735516770365352"
369+
"templateHash": "10245804339746056471"
370370
}
371371
},
372372
"parameters": {
@@ -1018,6 +1018,10 @@
10181018
"aiProjectName": {
10191019
"type": "string",
10201020
"value": "[variables('aiProjectName')]"
1021+
},
1022+
"applicationInsightsId": {
1023+
"type": "string",
1024+
"value": "[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]"
10211025
}
10221026
}
10231027
}
@@ -2339,6 +2343,9 @@
23392343
"imageTag": {
23402344
"value": "[parameters('imageTag')]"
23412345
},
2346+
"applicationInsightsId": {
2347+
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.applicationInsightsId.value]"
2348+
},
23422349
"solutionName": {
23432350
"value": "[variables('solutionPrefix')]"
23442351
},
@@ -2400,7 +2407,7 @@
24002407
"_generator": {
24012408
"name": "bicep",
24022409
"version": "0.33.93.31351",
2403-
"templateHash": "2717758861842552802"
2410+
"templateHash": "11969665804111861471"
24042411
}
24052412
},
24062413
"parameters": {
@@ -2535,6 +2542,9 @@
25352542
},
25362543
"imageTag": {
25372544
"type": "string"
2545+
},
2546+
"applicationInsightsId": {
2547+
"type": "string"
25382548
}
25392549
},
25402550
"variables": {
@@ -2570,7 +2580,7 @@
25702580
"appSettings": [
25712581
{
25722582
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
2573-
"value": "[reference(resourceId('Microsoft.Insights/components', parameters('ApplicationInsightsName')), '2015-05-01').InstrumentationKey]"
2583+
"value": "[reference(parameters('applicationInsightsId'), '2015-05-01').InstrumentationKey]"
25742584
},
25752585
{
25762586
"name": "AZURE_OPENAI_API_VERSION",
@@ -2661,23 +2671,9 @@
26612671
}
26622672
},
26632673
"dependsOn": [
2664-
"[resourceId('Microsoft.Insights/components', parameters('ApplicationInsightsName'))]",
26652674
"[resourceId('Microsoft.Web/serverfarms', parameters('HostingPlanName'))]"
26662675
]
26672676
},
2668-
{
2669-
"type": "Microsoft.Insights/components",
2670-
"apiVersion": "2020-02-02",
2671-
"name": "[parameters('ApplicationInsightsName')]",
2672-
"location": "[resourceGroup().location]",
2673-
"tags": {
2674-
"[format('hidden-link:{0}', resourceId('Microsoft.Web/sites', parameters('ApplicationInsightsName')))]": "Resource"
2675-
},
2676-
"properties": {
2677-
"Application_Type": "web"
2678-
},
2679-
"kind": "web"
2680-
},
26812677
{
26822678
"type": "Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments",
26832679
"apiVersion": "2022-05-15",

0 commit comments

Comments
 (0)