@@ -22,7 +22,7 @@ var backendSubnetName = 'backend-subnet'
22
22
var gatewaySubnetName = 'GatewaySubnet' // Required name for Gateway subnet
23
23
var dnsResolverSubnetName = 'dns-resolver-subnet'
24
24
var appServiceSubnetName = 'app-service-subnet'
25
- var containerAppsSubnetName = 'container-apps -subnet'
25
+ var containerAppsSubnetName = 'app-int -subnet'
26
26
27
27
module containerAppsNSG 'br/public:avm/res/network/network-security-group:0.5.1' = if (deploymentTarget == 'containerapps' ) {
28
28
name : 'container-apps-nsg'
@@ -31,19 +31,112 @@ module containerAppsNSG 'br/public:avm/res/network/network-security-group:0.5.1'
31
31
location : location
32
32
tags : tags
33
33
securityRules : [
34
+ // Inbound rules for Container Apps (Workload Profiles)
34
35
{
35
- name : 'AllowHttpsInbound '
36
+ name : 'AllowAzureLoadBalancerInbound '
36
37
properties : {
37
38
protocol : 'Tcp'
38
39
sourcePortRange : '*'
39
- sourceAddressPrefix : 'Internet '
40
- destinationPortRange : '443 '
41
- destinationAddressPrefix : '*'
40
+ sourceAddressPrefix : 'AzureLoadBalancer '
41
+ destinationPortRange : '30000-32767 '
42
+ destinationAddressPrefix : '10.0.0.0/21' // Container apps subnet
42
43
access : 'Allow'
43
44
priority : 100
44
45
direction : 'Inbound'
45
46
}
46
47
}
48
+ // Outbound rules for Container Apps (Workload Profiles)
49
+ {
50
+ name : 'AllowMicrosoftContainerRegistryOutbound'
51
+ properties : {
52
+ protocol : 'Tcp'
53
+ sourcePortRange : '*'
54
+ sourceAddressPrefix : '10.0.0.0/21' // Container apps subnet
55
+ destinationPortRange : '443'
56
+ destinationAddressPrefix : 'MicrosoftContainerRegistry'
57
+ access : 'Allow'
58
+ priority : 100
59
+ direction : 'Outbound'
60
+ }
61
+ }
62
+ {
63
+ name : 'AllowAzureFrontDoorOutbound'
64
+ properties : {
65
+ protocol : 'Tcp'
66
+ sourcePortRange : '*'
67
+ sourceAddressPrefix : '10.0.0.0/21' // Container apps subnet
68
+ destinationPortRange : '443'
69
+ destinationAddressPrefix : 'AzureFrontDoor.FirstParty'
70
+ access : 'Allow'
71
+ priority : 110
72
+ direction : 'Outbound'
73
+ }
74
+ }
75
+ {
76
+ name : 'AllowContainerAppsSubnetOutbound'
77
+ properties : {
78
+ protocol : '*'
79
+ sourcePortRange : '*'
80
+ sourceAddressPrefix : '10.0.0.0/21' // Container apps subnet
81
+ destinationPortRange : '*'
82
+ destinationAddressPrefix : '10.0.0.0/21' // Container apps subnet
83
+ access : 'Allow'
84
+ priority : 120
85
+ direction : 'Outbound'
86
+ }
87
+ }
88
+ {
89
+ name : 'AllowAzureActiveDirectoryOutbound'
90
+ properties : {
91
+ protocol : 'Tcp'
92
+ sourcePortRange : '*'
93
+ sourceAddressPrefix : '10.0.0.0/21' // Container apps subnet
94
+ destinationPortRange : '443'
95
+ destinationAddressPrefix : 'AzureActiveDirectory'
96
+ access : 'Allow'
97
+ priority : 130
98
+ direction : 'Outbound'
99
+ }
100
+ }
101
+ {
102
+ name : 'AllowAzureMonitorOutbound'
103
+ properties : {
104
+ protocol : 'Tcp'
105
+ sourcePortRange : '*'
106
+ sourceAddressPrefix : '10.0.0.0/21' // Container apps subnet
107
+ destinationPortRange : '443'
108
+ destinationAddressPrefix : 'AzureMonitor'
109
+ access : 'Allow'
110
+ priority : 140
111
+ direction : 'Outbound'
112
+ }
113
+ }
114
+ {
115
+ name : 'AllowAzureDnsOutbound'
116
+ properties : {
117
+ protocol : '*'
118
+ sourcePortRange : '*'
119
+ sourceAddressPrefix : '10.0.0.0/21' // Container apps subnet
120
+ destinationPortRange : '53'
121
+ destinationAddressPrefix : '168.63.129.16'
122
+ access : 'Allow'
123
+ priority : 150
124
+ direction : 'Outbound'
125
+ }
126
+ }
127
+ {
128
+ name : 'AllowStorageRegionOutbound'
129
+ properties : {
130
+ protocol : 'Tcp'
131
+ sourcePortRange : '*'
132
+ sourceAddressPrefix : '10.0.0.0/21' // Container apps subnet
133
+ destinationPortRange : '443'
134
+ destinationAddressPrefix : 'Storage.${location }'
135
+ access : 'Allow'
136
+ priority : 160
137
+ direction : 'Outbound'
138
+ }
139
+ }
47
140
]
48
141
}
49
142
}
@@ -253,4 +346,4 @@ output privateDnsResolverSubnetId string = useVpnGateway ? vnet.outputs.subnetRe
253
346
output appSubnetId string = vnet .outputs .subnetResourceIds [appSubnetIndex ]
254
347
output vnetName string = vnet .outputs .name
255
348
output vnetId string = vnet .outputs .resourceId
256
- output virtualNetworkGatewayName string = useVpnGateway ? virtualNetworkGateway !.outputs .name : ''
349
+ output virtualNetworkGatewayId string = useVpnGateway ? virtualNetworkGateway !.outputs .resourceId : ''
0 commit comments