File tree Expand file tree Collapse file tree 5 files changed +69
-0
lines changed
Expand file tree Collapse file tree 5 files changed +69
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ param location string
44param logAnalyticsWorkspaceName string
55param applicationInsightsName string
66param daprEnabled bool
7+ param vnetName string
78
89// Container apps host (including container registry)
910module containerApps '../core/host/container-apps.bicep' = {
@@ -16,6 +17,7 @@ module containerApps '../core/host/container-apps.bicep' = {
1617 logAnalyticsWorkspaceName : logAnalyticsWorkspaceName
1718 applicationInsightsName : applicationInsightsName
1819 daprEnabled : daprEnabled
20+ vnetName : vnetName
1921 }
2022}
2123
Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ param logAnalyticsWorkspaceName string
66param applicationInsightsName string = ''
77param daprEnabled bool = false
88
9+ @description ('Name of the Vnet' )
10+ param vnetName string
11+
912resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2022-03-01' = {
1013 name : name
1114 location : location
@@ -19,9 +22,16 @@ resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2022-03-01'
1922 }
2023 }
2124 daprAIInstrumentationKey : daprEnabled && applicationInsightsName != '' ? applicationInsights .properties .InstrumentationKey : ''
25+ vnetConfiguration : {
26+ infrastructureSubnetId : vnet .properties .subnets [0 ].id
27+ }
2228 }
2329}
2430
31+ resource vnet 'Microsoft.Network/virtualNetworks@2021-05-01' existing = {
32+ name : vnetName
33+ }
34+
2535resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' existing = {
2636 name : logAnalyticsWorkspaceName
2737}
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ param containerRegistryName string = ''
77param logAnalyticsWorkspaceName string = ''
88param applicationInsightsName string = ''
99param daprEnabled bool = false
10+ param vnetName string
1011
1112module containerAppsEnvironment 'container-apps-environment.bicep' = {
1213 name : '${name }-container-apps-environment'
@@ -17,6 +18,7 @@ module containerAppsEnvironment 'container-apps-environment.bicep' = {
1718 logAnalyticsWorkspaceName : logAnalyticsWorkspaceName
1819 applicationInsightsName : applicationInsightsName
1920 daprEnabled : daprEnabled
21+ vnetName : vnetName
2022 }
2123}
2224
Original file line number Diff line number Diff line change 1+ param location string
2+ param vnetName string
3+ param vnetPrefix string
4+ param subnets array
5+
6+ resource vnet 'Microsoft.Network/virtualNetworks@2021-05-01' = {
7+ name : vnetName
8+ location : location
9+ properties : {
10+ addressSpace : {
11+ addressPrefixes : [
12+ vnetPrefix
13+ ]
14+ }
15+ subnets : subnets
16+ }
17+ }
18+
19+ @batchSize (1 )
20+ resource vnetSubnets 'Microsoft.Network/virtualNetworks/subnets@2020-08-01' = [ for subnet in subnets : {
21+ parent : vnet
22+ name : '${subnet .name }'
23+ properties : {
24+ addressPrefix : subnet .properties .addressPrefix
25+ privateEndpointNetworkPolicies : 'Disabled'
26+ privateLinkServiceNetworkPolicies : 'Enabled'
27+ }
28+ }]
29+
30+ output vnetName string = vnet .name
Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ param workerImageName string = ''
3939var abbrs = loadJsonContent ('./abbreviations.json' )
4040var resourceToken = toLower (uniqueString (subscription ().id , environmentName , location ))
4141var tags = { 'azd-env-name' : environmentName }
42+ param vnetName string = 'vnet-ca'
43+ param vnetPrefix string = '10.0.0.0/16'
4244
4345// Organize resources in a resource group
4446resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
@@ -58,6 +60,29 @@ module appEnv './app/app-env.bicep' = {
5860 logAnalyticsWorkspaceName : monitoring .outputs .logAnalyticsWorkspaceName
5961 applicationInsightsName : monitoring .outputs .applicationInsightsName
6062 daprEnabled : true
63+ vnetName : vnet .outputs .vnetName
64+ }
65+ }
66+ var containerAppsSubnet = {
67+ name : 'ContainerAppsSubnet'
68+ properties : {
69+ addressPrefix : '10.0.0.0/23'
70+ }
71+ }
72+
73+ var subnets = [
74+ containerAppsSubnet
75+ ]
76+
77+ // Deploy an Azure Virtual Network
78+ module vnet 'core/networking/vnet.bicep' = {
79+ name : '${deployment ().name }--vnet'
80+ scope : rg
81+ params : {
82+ location : location
83+ vnetName : vnetName
84+ vnetPrefix : vnetPrefix
85+ subnets : subnets
6186 }
6287}
6388
You can’t perform that action at this time.
0 commit comments