@@ -1164,11 +1164,13 @@ module isolation 'network-isolation.bicep' = if (usePrivateEndpoint) {
1164
1164
location : location
1165
1165
tags : tags
1166
1166
vnetName : '${abbrs .virtualNetworks }${resourceToken }'
1167
- deployVpnGateway : useVpnGateway
1167
+ useVpnGateway : useVpnGateway
1168
1168
deploymentTarget : deploymentTarget
1169
1169
// Need to check deploymentTarget due to https://github.com/Azure/bicep/issues/3990
1170
1170
appServicePlanName : deploymentTarget == 'appservice' ? appServicePlan .outputs .name : ''
1171
1171
//containerAppsEnvName: deploymentTarget == 'containerapps' ? acaManagedEnvironmentName : ''
1172
+ vpnGatewayName : useVpnGateway ? '${abbrs .networkVpnGateways }${resourceToken }' : ''
1173
+ dnsResolverName : useVpnGateway ? '${abbrs .privateDnsResolver }${resourceToken }' : ''
1172
1174
}
1173
1175
}
1174
1176
@@ -1197,6 +1199,16 @@ var cognitiveServicesPrivateEndpointConnection = (usePrivateEndpoint && (!useLoc
1197
1199
}
1198
1200
]
1199
1201
: []
1202
+
1203
+ var containerAppsPrivateEndpointConnection = (usePrivateEndpoint && deploymentTarget == 'containerapps' )
1204
+ ? [
1205
+ {
1206
+ groupId : 'managedEnvironments'
1207
+ dnsZoneName : 'privatelink.${location }.azurecontainerapps.io'
1208
+ resourceIds : [containerApps .outputs .environmentId ]
1209
+ }
1210
+ ]
1211
+ : []
1200
1212
var otherPrivateEndpointConnections = (usePrivateEndpoint )
1201
1213
? [
1202
1214
{
@@ -1217,7 +1229,7 @@ var otherPrivateEndpointConnections = (usePrivateEndpoint)
1217
1229
]
1218
1230
: []
1219
1231
1220
- var privateEndpointConnections = concat (otherPrivateEndpointConnections , openAiPrivateEndpointConnection , cognitiveServicesPrivateEndpointConnection )
1232
+ var privateEndpointConnections = concat (otherPrivateEndpointConnections , openAiPrivateEndpointConnection , cognitiveServicesPrivateEndpointConnection , containerAppsPrivateEndpointConnection )
1221
1233
1222
1234
module privateEndpoints 'private-endpoints.bicep' = if (usePrivateEndpoint ) {
1223
1235
name : 'privateEndpoints'
@@ -1230,99 +1242,7 @@ module privateEndpoints 'private-endpoints.bicep' = if (usePrivateEndpoint) {
1230
1242
applicationInsightsId : useApplicationInsights ? monitoring .outputs .applicationInsightsId : ''
1231
1243
logAnalyticsWorkspaceId : useApplicationInsights ? monitoring .outputs .logAnalyticsWorkspaceId : ''
1232
1244
vnetName : isolation .outputs .vnetName
1233
- vnetPeSubnetName : isolation .outputs .backendSubnetId
1234
- }
1235
- }
1236
-
1237
- // Based on https://luke.geek.nz/azure/azure-point-to-site-vpn-and-private-dns-resolver/
1238
- // Manual step required of updating azurevpnconfig.xml to use the correct DNS server IP address
1239
- module dnsResolver 'br/public:avm/res/network/dns-resolver:0.5.4' = if (useVpnGateway ) {
1240
- name : 'dns-resolver'
1241
- scope : resourceGroup
1242
- params : {
1243
- name : '${abbrs .privateDnsResolver }${resourceToken }'
1244
- location : location
1245
- virtualNetworkResourceId : isolation .outputs .vnetId
1246
- inboundEndpoints : [
1247
- {
1248
- name : 'inboundEndpoint'
1249
- subnetResourceId : useVpnGateway ? isolation .outputs .privateDnsResolverSubnetId : ''
1250
- }
1251
- ]
1252
- }
1253
- }
1254
-
1255
- // Container Apps Private DNS Zone
1256
- module containerAppsPrivateDnsZone 'br/public:avm/res/network/private-dns-zone:0.7.1' = if (usePrivateEndpoint && deploymentTarget == 'containerapps' ) {
1257
- name : 'container-apps-dns-zone'
1258
- scope : resourceGroup
1259
- params : {
1260
- name : 'privatelink.${location }.azurecontainerapps.io'
1261
- tags : tags
1262
- virtualNetworkLinks : [
1263
- {
1264
- registrationEnabled : false
1265
- virtualNetworkResourceId : isolation .outputs .vnetId
1266
- }
1267
- ]
1268
- }
1269
- }
1270
-
1271
- // Container Apps Environment Private Endpoint
1272
- // https://learn.microsoft.com/azure/container-apps/how-to-use-private-endpoint
1273
- module containerAppsEnvironmentPrivateEndpoint 'br/public:avm/res/network/private-endpoint:0.11.0' = if (usePrivateEndpoint && deploymentTarget == 'containerapps' ) {
1274
- name : 'containerAppsEnvironmentPrivateEndpointDeployment'
1275
- scope : resourceGroup
1276
- params : {
1277
- name : 'container-apps-env-pe${resourceToken }'
1278
- location : location
1279
- tags : tags
1280
- subnetResourceId : isolation .outputs .backendSubnetId
1281
- privateDnsZoneGroup : {
1282
- privateDnsZoneGroupConfigs : [
1283
- {
1284
- privateDnsZoneResourceId : containerAppsPrivateDnsZone .outputs .resourceId
1285
- }
1286
- ]
1287
- }
1288
- privateLinkServiceConnections : [
1289
- {
1290
- name : 'containerAppsEnvironmentConnection'
1291
- properties : {
1292
- groupIds : [
1293
- 'managedEnvironments'
1294
- ]
1295
- privateLinkServiceId : containerApps .outputs .environmentId
1296
- }
1297
- }
1298
- ]
1299
- }
1300
- }
1301
-
1302
- module virtualNetworkGateway 'br/public:avm/res/network/virtual-network-gateway:0.8.0' = if (useVpnGateway ) {
1303
- name : 'virtual-network-gateway'
1304
- scope : resourceGroup
1305
- params : {
1306
- name : '${abbrs .networkVpnGateways }${resourceToken }'
1307
- clusterSettings : {
1308
- clusterMode : 'activePassiveNoBgp'
1309
- }
1310
- gatewayType : 'Vpn'
1311
- virtualNetworkResourceId : isolation .outputs .vnetId
1312
- vpnGatewayGeneration : 'Generation2'
1313
- vpnClientAddressPoolPrefix : '172.16.201.0/24'
1314
- skuName : 'VpnGw2'
1315
- vpnClientAadConfiguration : {
1316
- aadAudience : 'c632b3df-fb67-4d84-bdcf-b95ad541b5c8' // Azure VPN client
1317
- aadIssuer : 'https://sts.windows.net/${tenant ().tenantId }/'
1318
- aadTenant : '${environment ().authentication .loginEndpoint }${tenant ().tenantId }'
1319
- vpnAuthenticationTypes : [
1320
- 'AAD'
1321
- ]
1322
- vpnClientProtocols : [
1323
- 'OpenVPN'
1324
- ]
1325
- }
1245
+ vnetPeSubnetId : isolation .outputs .backendSubnetId
1326
1246
}
1327
1247
}
1328
1248
@@ -1451,4 +1371,4 @@ output AZURE_CONTAINER_REGISTRY_ENDPOINT string = deploymentTarget == 'container
1451
1371
? containerApps .outputs .registryLoginServer
1452
1372
: ''
1453
1373
1454
- output AZURE_VPN_CONFIG_DOWNLOAD_LINK string = useVpnGateway ? 'https://portal.azure.com/#@${tenant ().tenantId }/resource/subscriptions/${subscription ().subscriptionId }/resourceGroups/${resourceGroup .name }/providers/Microsoft.Network/virtualNetworkGateways/${virtualNetworkGateway .outputs .name }/pointtositeconfiguration' : ''
1374
+ output AZURE_VPN_CONFIG_DOWNLOAD_LINK string = useVpnGateway ? 'https://portal.azure.com/#@${tenant ().tenantId }/resource/subscriptions/${subscription ().subscriptionId }/resourceGroups/${resourceGroup .name }/providers/Microsoft.Network/virtualNetworkGateways/${isolation .outputs .virtualNetworkGatewayName }/pointtositeconfiguration' : ''
0 commit comments