Skip to content

Commit 008e6ef

Browse files
committed
Update subnet and NSG rules for container apps
Changed container apps subnet address prefix from '10.0.0.0/21' to '10.0.16.0/21' in network-isolation.bicep and related NSG rules. Added Google DNS IP (8.8.8.8) to Cosmos DB ipRules in main.bicep for public network access.
1 parent b96b186 commit 008e6ef

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

infra/main.bicep

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,9 @@ module cosmosDb 'br/public:avm/res/document-db/database-account:0.6.1' = if (use
878878
enableFreeTier: cosmosDbSkuName == 'free'
879879
capabilitiesToAdd: cosmosDbSkuName == 'serverless' ? ['EnableServerless'] : []
880880
networkRestrictions: {
881-
ipRules: []
881+
ipRules: [
882+
'8.8.8.8' // Google DNS (publicly routable)
883+
]
882884
networkAclBypass: bypass
883885
publicNetworkAccess: publicNetworkAccess
884886
virtualNetworkRules: []

infra/network-isolation.bicep

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module containerAppsNSG 'br/public:avm/res/network/network-security-group:0.5.1'
3939
sourcePortRange: '*'
4040
sourceAddressPrefix: 'AzureLoadBalancer'
4141
destinationPortRange: '30000-32767'
42-
destinationAddressPrefix: '10.0.0.0/21' // Container apps subnet
42+
destinationAddressPrefix: '10.0.16.0/21' // Container apps subnet
4343
access: 'Allow'
4444
priority: 100
4545
direction: 'Inbound'
@@ -51,7 +51,7 @@ module containerAppsNSG 'br/public:avm/res/network/network-security-group:0.5.1'
5151
properties: {
5252
protocol: 'Tcp'
5353
sourcePortRange: '*'
54-
sourceAddressPrefix: '10.0.0.0/21' // Container apps subnet
54+
sourceAddressPrefix: '10.0.16.0/21' // Container apps subnet
5555
destinationPortRange: '443'
5656
destinationAddressPrefix: 'MicrosoftContainerRegistry'
5757
access: 'Allow'
@@ -64,7 +64,7 @@ module containerAppsNSG 'br/public:avm/res/network/network-security-group:0.5.1'
6464
properties: {
6565
protocol: 'Tcp'
6666
sourcePortRange: '*'
67-
sourceAddressPrefix: '10.0.0.0/21' // Container apps subnet
67+
sourceAddressPrefix: '10.0.16.0/21' // Container apps subnet
6868
destinationPortRange: '443'
6969
destinationAddressPrefix: 'AzureFrontDoor.FirstParty'
7070
access: 'Allow'
@@ -77,9 +77,9 @@ module containerAppsNSG 'br/public:avm/res/network/network-security-group:0.5.1'
7777
properties: {
7878
protocol: '*'
7979
sourcePortRange: '*'
80-
sourceAddressPrefix: '10.0.0.0/21' // Container apps subnet
80+
sourceAddressPrefix: '10.0.16.0/21' // Container apps subnet
8181
destinationPortRange: '*'
82-
destinationAddressPrefix: '10.0.0.0/21' // Container apps subnet
82+
destinationAddressPrefix: '10.0.16.0/21' // Container apps subnet
8383
access: 'Allow'
8484
priority: 120
8585
direction: 'Outbound'
@@ -90,7 +90,7 @@ module containerAppsNSG 'br/public:avm/res/network/network-security-group:0.5.1'
9090
properties: {
9191
protocol: 'Tcp'
9292
sourcePortRange: '*'
93-
sourceAddressPrefix: '10.0.0.0/21' // Container apps subnet
93+
sourceAddressPrefix: '10.0.16.0/21' // Container apps subnet
9494
destinationPortRange: '443'
9595
destinationAddressPrefix: 'AzureActiveDirectory'
9696
access: 'Allow'
@@ -103,7 +103,7 @@ module containerAppsNSG 'br/public:avm/res/network/network-security-group:0.5.1'
103103
properties: {
104104
protocol: 'Tcp'
105105
sourcePortRange: '*'
106-
sourceAddressPrefix: '10.0.0.0/21' // Container apps subnet
106+
sourceAddressPrefix: '10.0.16.0/21' // Container apps subnet
107107
destinationPortRange: '443'
108108
destinationAddressPrefix: 'AzureMonitor'
109109
access: 'Allow'
@@ -116,7 +116,7 @@ module containerAppsNSG 'br/public:avm/res/network/network-security-group:0.5.1'
116116
properties: {
117117
protocol: '*'
118118
sourcePortRange: '*'
119-
sourceAddressPrefix: '10.0.0.0/21' // Container apps subnet
119+
sourceAddressPrefix: '10.0.16.0/21' // Container apps subnet
120120
destinationPortRange: '53'
121121
destinationAddressPrefix: '168.63.129.16'
122122
access: 'Allow'
@@ -129,7 +129,7 @@ module containerAppsNSG 'br/public:avm/res/network/network-security-group:0.5.1'
129129
properties: {
130130
protocol: 'Tcp'
131131
sourcePortRange: '*'
132-
sourceAddressPrefix: '10.0.0.0/21' // Container apps subnet
132+
sourceAddressPrefix: '10.0.16.0/21' // Container apps subnet
133133
destinationPortRange: '443'
134134
destinationAddressPrefix: 'Storage.${location}'
135135
access: 'Allow'
@@ -284,7 +284,7 @@ module vnet 'br/public:avm/res/network/virtual-network:0.6.1' = {
284284
: [
285285
{
286286
name: containerAppsSubnetName
287-
addressPrefix: '10.0.0.0/21'
287+
addressPrefix: '10.0.16.0/21'
288288
delegation: 'Microsoft.App/environments'
289289
networkSecurityGroupResourceId: containerAppsNSG!.outputs.resourceId
290290
}

0 commit comments

Comments
 (0)