@@ -2,62 +2,45 @@ param name string
22param location string = resourceGroup ().location
33param tags object = {}
44
5- param daprEnabled bool = false
65param logAnalyticsWorkspaceName string = ''
7- param applicationInsightsName string = ''
86
97@description ('Virtual network name for container apps environment.' )
108param vnetName string = ''
119@description ('Subnet name for container apps environment integration.' )
1210param subnetName string = ''
13- param subnetResourceId string
11+ param subnetResourceId string = ''
1412
15- param usePrivateIngress bool = true
13+ param usePrivateIngress bool = false
1614
17- resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2025-01-01' = {
18- name : name
19- location : location
20- tags : tags
21- properties : {
22- appLogsConfiguration : !empty (logAnalyticsWorkspaceName ) ? {
23- destination : 'log-analytics'
24- logAnalyticsConfiguration : {
25- customerId : logAnalyticsWorkspace .properties .customerId
26- sharedKey : logAnalyticsWorkspace .listKeys ().primarySharedKey
27- }
28- } : null
29- daprAIInstrumentationKey : daprEnabled && !empty (applicationInsightsName ) ? applicationInsights .properties .InstrumentationKey : ''
30- vnetConfiguration : (!empty (vnetName ) && !empty (subnetName )) ? {
31- // Use proper subnet resource ID format
32- infrastructureSubnetId : subnetResourceId
33- internal : usePrivateIngress
34- } : null
35- // Configure workload profile for dedicated environment (not consumption)
36- workloadProfiles : usePrivateIngress
37- ? [
38- {
39- name : 'Consumption'
40- workloadProfileType : 'Consumption'
41- }
42- {
43- name : 'Warm'
44- workloadProfileType : 'D4'
45- minimumCount : 1
46- maximumCount : 3
47- }
48- ]
49- : []
50- }
51- }
15+ var useVnet = !empty (vnetName ) && !empty (subnetName )
16+ var useLogging = !empty (logAnalyticsWorkspaceName )
5217
53- resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' existing = if (! empty ( logAnalyticsWorkspaceName ) ) {
18+ resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' existing = if (useLogging ) {
5419 name : logAnalyticsWorkspaceName
5520}
5621
57- resource applicationInsights 'Microsoft.Insights/components@2020-02-02' existing = if (daprEnabled && !empty (applicationInsightsName )){
58- name : applicationInsightsName
22+ module containerAppsEnvironment 'br/public:avm/res/app/managed-environment:0.11.3' = {
23+ name : take ('${name }-aca-env' , 64 )
24+ params : {
25+ name : name
26+ location : location
27+ tags : tags
28+ zoneRedundant : false
29+ publicNetworkAccess : 'Enabled'
30+ appLogsConfiguration : useLogging ? {
31+ destination : 'log-analytics'
32+ logAnalyticsConfiguration : {
33+ customerId : logAnalyticsWorkspace !.properties .customerId
34+ sharedKey : logAnalyticsWorkspace !.listKeys ().primarySharedKey
35+ }
36+ } : {
37+ destination : 'azure-monitor'
38+ }
39+ internal : useVnet ? usePrivateIngress : false
40+ infrastructureSubnetResourceId : useVnet ? subnetResourceId : ''
41+ }
5942}
6043
61- output defaultDomain string = containerAppsEnvironment .properties .defaultDomain
62- output name string = containerAppsEnvironment .name
63- output resourceId string = containerAppsEnvironment .id
44+ output defaultDomain string = containerAppsEnvironment .outputs .defaultDomain
45+ output name string = containerAppsEnvironment .outputs . name
46+ output resourceId string = containerAppsEnvironment .outputs . resourceId
0 commit comments