Skip to content

Commit 1b6203f

Browse files
committed
Update Log Analytics workspace and app insights avm
1 parent 70a0a49 commit 1b6203f

3 files changed

Lines changed: 58 additions & 37 deletions

File tree

infra/main.bicep

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -197,30 +197,41 @@ module avmKeyVault_RoleAssignment_appConfig 'br/public:avm/ptn/authorization/res
197197
// }
198198

199199
// ========== Application insights ========== //
200-
module avmLogAnalyticsWorkspace 'br/public:avm/res/operational-insights/workspace:0.11.2' = {
201-
name: format(deployment_param.resource_name_format_string, abbrs.managementGovernance.logAnalyticsWorkspace)
200+
module avmAppInsightsLogAnalyticsWorkspace './modules/app-insights.bicep' = {
201+
//name: format(deployment_param.resource_name_format_string, abbrs.managementGovernance.logAnalyticsWorkspace)
202202
params: {
203-
name: '${abbrs.managementGovernance.logAnalyticsWorkspace}${deployment_param.solution_prefix}'
204-
location: deployment_param.resource_group_location
205-
diagnosticSettings: [{ useThisWorkspace: true }]
206-
skuName: 'PerGB2018'
207-
dataRetention: 30
203+
appInsights_param: {
204+
appInsightsName: '${abbrs.managementGovernance.applicationInsights}${deployment_param.solution_prefix}'
205+
location: deployment_param.resource_group_location
206+
//diagnosticSettings: [{ useThisWorkspace: true }]
207+
skuName: 'PerGB2018'
208+
applicationType: 'web'
209+
disableIpMasking: false
210+
disableLocalAuth: false
211+
flowType: 'Bluefield'
212+
kind: 'web'
213+
logAnalyticsWorkspaceName: '${abbrs.managementGovernance.logAnalyticsWorkspace}${deployment_param.solution_prefix}'
214+
publicNetworkAccessForQuery: 'Enabled'
215+
requestSource: 'rest'
216+
retentionInDays: 30
217+
}
218+
deployment_param: deployment_param
208219
}
209220
}
210221

211-
module avmApplicationInsights 'br/public:avm/res/insights/component:0.6.0' = {
212-
name: format(deployment_param.resource_name_format_string, abbrs.managementGovernance.applicationInsights)
213-
params: {
214-
name: '${abbrs.managementGovernance.applicationInsights}${deployment_param.solution_prefix}'
215-
location: deployment_param.resource_group_location
216-
workspaceResourceId: avmLogAnalyticsWorkspace.outputs.resourceId
217-
retentionInDays: 30
218-
kind: 'web'
219-
disableIpMasking: false
220-
flowType: 'Bluefield'
221-
diagnosticSettings: [{ workspaceResourceId: avmLogAnalyticsWorkspace.outputs.resourceId }]
222-
}
223-
}
222+
// module avmApplicationInsights 'br/public:avm/res/insights/component:0.6.0' = {
223+
// name: format(deployment_param.resource_name_format_string, abbrs.managementGovernance.applicationInsights)
224+
// params: {
225+
// name: '${abbrs.managementGovernance.applicationInsights}${deployment_param.solution_prefix}'
226+
// location: deployment_param.resource_group_location
227+
// workspaceResourceId: avmLogAnalyticsWorkspace.outputs.resourceId
228+
// retentionInDays: 30
229+
// kind: 'web'
230+
// disableIpMasking: false
231+
// flowType: 'Bluefield'
232+
// diagnosticSettings: [{ workspaceResourceId: avmLogAnalyticsWorkspace.outputs.resourceId }]
233+
// }
234+
// }
224235

225236
// module applicationInsights 'deploy_app_insights.bicep' = {
226237
// name: 'deploy_app_insights'
@@ -462,7 +473,8 @@ module avmAiServices_storage_hub 'br/public:avm/res/storage/storage-account:0.20
462473
allowSharedKeyAccess: false
463474
diagnosticSettings: [
464475
{
465-
workspaceResourceId: avmLogAnalyticsWorkspace.outputs.resourceId
476+
//workspaceResourceId: avmLogAnalyticsWorkspace.outputs.resourceId
477+
workspaceResourceId: avmAppInsightsLogAnalyticsWorkspace.outputs.logAnalyticsWorkspaceResourceId
466478
}
467479
]
468480
blobServices: {
@@ -471,7 +483,8 @@ module avmAiServices_storage_hub 'br/public:avm/res/storage/storage-account:0.20
471483
containerDeleteRetentionPoloicyEnabled: false
472484
diagnosticSettings: [
473485
{
474-
workspaceResourceId: avmLogAnalyticsWorkspace.outputs.resourceId
486+
//workspaceResourceId: avmLogAnalyticsWorkspace.outputs.resourceId
487+
workspaceResourceId: avmAppInsightsLogAnalyticsWorkspace.outputs.logAnalyticsWorkspaceResourceId
475488
}
476489
]
477490
}
@@ -503,7 +516,7 @@ module avmAiHub 'br/public:avm/res/machine-learning-services/workspace:0.12.1' =
503516
associatedKeyVaultResourceId: avmKeyVault.outputs.resourceId
504517
associatedStorageAccountResourceId: avmAiServices_storage_hub.outputs.resourceId
505518
associatedContainerRegistryResourceId: avmContainerRegistry.outputs.resourceId
506-
associatedApplicationInsightsResourceId: avmApplicationInsights.outputs.resourceId
519+
associatedApplicationInsightsResourceId: avmAppInsightsLogAnalyticsWorkspace.outputs.applicationInsightsId
507520

508521
kind: 'Hub'
509522
connections: [
@@ -571,8 +584,8 @@ module avmContainerAppEnv 'br/public:avm/res/app/managed-environment:0.11.1' = {
571584
appLogsConfiguration: {
572585
destination: 'log-analytics'
573586
logAnalyticsConfiguration: {
574-
customerId: avmLogAnalyticsWorkspace.outputs.logAnalyticsWorkspaceId
575-
sharedKey: avmLogAnalyticsWorkspace.outputs.primarySharedKey
587+
customerId: avmAppInsightsLogAnalyticsWorkspace.outputs.logAnalyticsWorkspaceId
588+
sharedKey: avmAppInsightsLogAnalyticsWorkspace.outputs.logAnalyticsWorkspacePrimaryKey
576589
}
577590
}
578591
zoneRedundant: false

infra/modules/app-insights.bicep

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module avmLogAnalyticsWorkspace 'br/public:avm/res/operational-insights/workspac
2626
location: appInsights_param.location
2727
skuName: appInsights_param.skuName
2828
dataRetention: appInsights_param.retentionInDays
29+
diagnosticSettings: [ { useThisWorkspace: true }] //TODO: Add as a parameter
2930
// features: {
3031
// searchVersion: appInsights_param.features.searchVersion
3132
// }
@@ -43,16 +44,19 @@ module avmApplicationInsights 'br/public:avm/res/insights/component:0.6.0' = {
4344
disableIpMasking: appInsights_param.disableIpMasking
4445
disableLocalAuth: appInsights_param.disableLocalAuth
4546
flowType: appInsights_param.flowType
46-
forceCustomerStorageForProfiler: appInsights_param.forceCustomerStorageForProfiler
47+
//forceCustomerStorageForProfiler: appInsights_param.forceCustomerStorageForProfiler
4748
//immediatePurgeDataOn30Days: false
4849
//IngestionMode: 'LogAnalytics'
49-
publicNetworkAccessForIngestion: appInsights_param.publicNetworkAccessForIngestion
50+
//publicNetworkAccessForIngestion: appInsights_param.publicNetworkAccessForIngestion
5051
publicNetworkAccessForQuery: appInsights_param.publicNetworkAccessForQuery
5152
requestSource: appInsights_param.requestSource
5253

5354
}
5455
}
5556

5657
output applicationInsightsId string = avmApplicationInsights.outputs.resourceId
57-
output logAnalyticsWorkspaceId string = avmLogAnalyticsWorkspace.outputs.resourceId
58+
output logAnalyticsWorkspaceId string = avmLogAnalyticsWorkspace.outputs.logAnalyticsWorkspaceId
59+
output logAnalyticsWorkspaceResourceId string = avmLogAnalyticsWorkspace.outputs.resourceId
5860
output logAnalyticsWorkspaceName string = avmLogAnalyticsWorkspace.outputs.name
61+
@secure()
62+
output logAnalyticsWorkspacePrimaryKey string = avmLogAnalyticsWorkspace.outputs.primarySharedKey

infra/modules/types.bicep

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ type app_insights_param_type = {
128128
applicationType: app_insights_applicationType
129129
@description('Disable local authentication for the Application Insights resource')
130130
disableLocalAuth: bool
131-
@description('Force customer storage for profiler in Application Insights resource')
132-
forceCustomerStorageForProfiler: bool
133-
@description('Public network access for ingestion in Application Insights resource')
134-
publicNetworkAccessForIngestion: 'Enabled' | 'Disabled'
131+
// @description('Force customer storage for profiler in Application Insights resource')
132+
// forceCustomerStorageForProfiler: bool
133+
// @description('Public network access for ingestion in Application Insights resource')
134+
// publicNetworkAccessForIngestion: 'Enabled' | 'Disabled'
135135
@description('Public network access for query in Application Insights resource')
136136
publicNetworkAccessForQuery: 'Enabled' | 'Disabled'
137137
@description('Request source for the Application Insights resource')
@@ -141,11 +141,15 @@ type app_insights_param_type = {
141141
logAnalyticsWorkspaceName: string
142142
@description('SKU name for the Log Analytics Workspace resource')
143143
skuName: app_insights_sku_name
144-
@description('This is the features properties for Log Analytics Workspace resource')
145-
features: {
146-
@description('Search version for the Log Analytics Workspace resource')
147-
searchVersion: 1
148-
}
144+
// @description('This is the features properties for Log Analytics Workspace resource') --DEFAULT to 1
145+
// features: {
146+
// @description('Search version for the Log Analytics Workspace resource')
147+
// searchVersion: 1
148+
// }
149+
// diagnosticSettings: {
150+
// @description('Enable diagnostic settings for the Application Insights resource')
151+
// enableDiagnosticSettings: bool
152+
// }
149153
}
150154

151155
type container_registry_sku_type = 'Basic' | 'Standard' | 'Premium'

0 commit comments

Comments
 (0)