Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit c71051b

Browse files
authored
Private Endpoint for App Service (Azure#144)
1 parent fff245d commit c71051b

32 files changed

+393
-28
lines changed

azresources/compute/web/appservice-linux-container.bicep

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ param aiIKey string
2828
@description('Virtual Network Integration Subnet Resource Id.')
2929
param vnetIntegrationSubnetId string
3030

31+
@description('Whether to deploy private endpoint for inbound traffic')
32+
param enablePrivateEndpoint bool
33+
34+
@description('Private DNS Zone Resource Id.')
35+
param privateZoneId string
36+
37+
@description('Private endpoint subnet ID')
38+
param privateEndpointSubnetId string
39+
40+
3141
// Linux Web App with Virtual Network Integration
3242
resource app 'Microsoft.Web/sites@2021-02-01' = {
3343
name: name
@@ -74,3 +84,39 @@ resource app 'Microsoft.Web/sites@2021-02-01' = {
7484
}
7585
}
7686
}
87+
88+
89+
resource appservice_linuxcontainer_pe 'Microsoft.Network/privateEndpoints@2020-06-01' = if (enablePrivateEndpoint) {
90+
location: resourceGroup().location
91+
name: '${app.name}-endpoint'
92+
properties: {
93+
subnet: {
94+
id: privateEndpointSubnetId
95+
}
96+
privateLinkServiceConnections: [
97+
{
98+
name: '${app.name}-endpoint'
99+
properties: {
100+
privateLinkServiceId: app.id
101+
groupIds: [
102+
'sites'
103+
]
104+
}
105+
}
106+
]
107+
}
108+
109+
resource appservice_pe_dns_reg 'privateDnsZoneGroups@2020-06-01' = {
110+
name: 'default'
111+
properties: {
112+
privateDnsZoneConfigs: [
113+
{
114+
name: 'privatelink_azure_websites_net'
115+
properties: {
116+
privateDnsZoneId: privateZoneId
117+
}
118+
}
119+
]
120+
}
121+
}
122+
}

config/subscriptions/CanadaESLZ-main/pubsec/LandingZones/DevTest/8c6e48a4-4c73-4a1f-9f95-9447804f2c98_machinelearning_canadacentral.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@
9696
"value": {
9797
"enabled": true,
9898
"skuName": "P1V2",
99-
"skuTier": "Premium"
99+
"skuTier": "Premium",
100+
"enablePrivateEndpoint": true
100101
}
101102
},
102103
"sqldb": {

config/subscriptions/CanadaESLZ-main/pubsec/LandingZones/DevTest/ec6c5689-db04-4f1e-b76d-834a51dd0e27_machinelearning_canadacentral.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@
103103
"value": {
104104
"enabled": true,
105105
"skuName": "P1V2",
106-
"skuTier": "Premium"
106+
"skuTier": "Premium",
107+
"enablePrivateEndpoint": true
107108
}
108109
},
109110
"sqldb": {

config/subscriptions/CanadaESLZ-main/pubsec/LandingZones/DevTest/f08c3057-1713-4a6f-b7e6-0df355b60c30_machinelearning_canadacentral.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@
103103
"value": {
104104
"enabled": true,
105105
"skuName": "P1V2",
106-
"skuTier": "Premium"
106+
"skuTier": "Premium",
107+
"enablePrivateEndpoint": true
107108
}
108109
},
109110
"sqldb": {

config/subscriptions/CanadaESLZ-main/pubsec/LandingZones/DevTest/f459218a-e8bb-49c9-b768-ee6828a144aa_machinelearning_canadacentral.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@
103103
"value": {
104104
"enabled": true,
105105
"skuName": "P1V2",
106-
"skuTier": "Premium"
106+
"skuTier": "Premium",
107+
"enablePrivateEndpoint": true
107108
}
108109
},
109110
"sqldb": {

docs/archetypes/machinelearning.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ Subscription can be moved to a target Management Group through Azure ARM Templat
8989
| Monitoring | Application Insights - Application performance and monitoring cloud service | - | [Azure Docs](https://docs.microsoft.com/azure/azure-monitor/app/app-insights-overview)
9090

9191

92-
> For App Service, for using the SKU tier `Premium` to support private endpoints, it may require a quota increase.
93-
9492
The intended cloud service workflows and data movements for this archetype include:
9593

9694
1. Data can be ingested from various sources using Data Factory, which uses managed virtual network for its Azure hosted integration runtime.
@@ -131,10 +129,12 @@ Once the machine learning archetype is deployed and available to use, access con
131129
| Azure Storage Account for Azure ML | Network ACL deny | Private endpoint on `blob`, `file` + DNS registration to either hub or spoke | `privateEndpoints`|
132130
| Azure Data Factory | Public network access disabled, Azure integration runtime with managed virtual network | Private endpoint on `dataFactory` + DNS registration to either hub or spoke | `privateEndpoints`|
133131
| Azure Kubernetes Service | Private cluster, network profile set with either kubenet or Azure CNI | N/A | `aks`|
134-
| Azure App Service | Virtual Network integration | N/A | `appService` |
132+
| Azure App Service | Virtual Network integration. Public network access can be disabled, using private endpoint instead | Private endpoint on `azureWebsites` + DNS registration to either hub or spoke | `appService`, `privateEndpoints` |
135133
| Azure Container Registry | Network ACL deny, public network access disabled | Private endpoint on `registry` + DNS registration to either hub or spoke | `privateEndpoints`|f
136134
| Azure Application Insights | N/A | N/A | N/A |
137135

136+
> For App Service, private endpoint requires the SKU tier `Premium`: https://docs.microsoft.com/azure/app-service/networking/private-endpoint so this may require a quota increase.
137+
138138
This archetype also has the following security features as options for deployment:
139139

140140
* Customer managed keys for encryption at rest, including Azure ML, storage, Container Registry, Data Factory, SQL Database / Managed Instance, and Kubernetes Service.
@@ -272,7 +272,7 @@ Reference implementation uses parameter files with `object` parameters to consol
272272
| Deployment with AKS using Network Plugin: Azure CNI + Network Policy: Calico | [tests/schemas/lz-machinelearning/AKS-AzureCNI-Calico.json](../../tests/schemas/lz-machinelearning/AKS-AzureCNI-Calico.json) | `parameters.aks.value.networkPlugin` equals ***azure***, `parameters.aks.value.networkPlugin` equals ***calico***, `parameters.aks.value.podCidr` is ***empty***, `parameters.aks.value.serviceCidr` is filled, `parameters.aks.value.dnsServiceIP` is filled and `parameters.aks.value.dockerBridgeCidr` is filled |
273273
| Deployment with AKS using Network Plugin: Azure CNI + Network Policy: Azure | [tests/schemas/lz-machinelearning/AKS-AzureCNI-AzureNP.json](../../tests/schemas/lz-machinelearning/AKS-AzureCNI-AzureNP.json) | `parameters.aks.value.networkPlugin` equals ***azure***, `parameters.aks.value.networkPlugin` equals ***azure***, `parameters.aks.value.podCidr` is ***empty***, `parameters.aks.value.serviceCidr` is filled, `parameters.aks.value.dnsServiceIP` is filled and `parameters.aks.value.dockerBridgeCidr` is filled |
274274
| Deployment without Azure App Service for Linux Containers | [tests/schemas/lz-machinelearning/AppServiceLinuxContainerIsFalse.json](../../tests/schemas/lz-machinelearning/AppServiceLinuxContainerIsFalse.json) | `parameters.appServiceLinuxContainer.value.enabled` is false. |
275-
275+
| Deployment with Azure App Service for Linux Containers without Private Endpoint| [tests/schemas/lz-machinelearning/AppServiceLinuxContainerPrivateEndpointIsFalse.json](../../tests/schemas/lz-machinelearning/AppServiceLinuxContainerPrivateEndpointIsFalse.json) | `parameters.appServiceLinuxContainer.value.enabled` is true, `parameters.appServiceLinuxContainer.value.sku{Name,Tier}` are filled, and `parameters.appServiceLinuxContainer.value.enablePrivateEndpoint` is false. |
276276
### Example Deployment Parameters
277277

278278
This example configures:
@@ -418,7 +418,8 @@ This example configures:
418418
"value": {
419419
"enabled": true,
420420
"skuName": "P1V2",
421-
"skuTier": "Premium"
421+
"skuTier": "Premium",
422+
"enablePrivateEndpoint": true
422423
}
423424
},
424425
"aml": {
0 Bytes
Loading

landingzones/lz-machinelearning/lz.bicep

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,10 @@ module appServiceLC '../../azresources/compute/web/appservice-linux-container.bi
414414
storageId: dataLakeMetaData.outputs.storageId
415415

416416
vnetIntegrationSubnetId: networking.outputs.appServiceSubnetId
417-
417+
enablePrivateEndpoint: appServiceLinuxContainer.enablePrivateEndpoint
418+
privateEndpointSubnetId: networking.outputs.privateEndpointSubnetId
419+
privateZoneId: networking.outputs.asPrivateDnsZoneId
420+
418421
tags: resourceTags
419422
}
420423
}

landingzones/lz-machinelearning/networking.bicep

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,21 @@ module privatezone_acr '../../azresources/network/private-dns-zone.bicep' = {
584584
}
585585
}
586586

587+
module privatezone_as '../../azresources/network/private-dns-zone.bicep' = {
588+
name: 'deploy-privatezone-as'
589+
scope: resourceGroup()
590+
params: {
591+
zone: 'privatelink.azurewebsites.net'
592+
vnetId: vnet.id
593+
594+
dnsCreateNewZone: !hubNetwork.privateDnsManagedByHub
595+
dnsLinkToVirtualNetwork: !hubNetwork.privateDnsManagedByHub || (hubNetwork.privateDnsManagedByHub && !usingCustomDNSServers)
596+
dnsExistingZoneSubscriptionId: hubNetwork.privateDnsManagedByHubSubscriptionId
597+
dnsExistingZoneResourceGroupName: hubNetwork.privateDnsManagedByHubResourceGroupName
598+
registrationEnabled: false
599+
}
600+
}
601+
587602
module privatezone_datalake_blob '../../azresources/network/private-dns-zone.bicep' = {
588603
name: 'deploy-privatezone-blob'
589604
scope: resourceGroup()
@@ -698,5 +713,6 @@ output sqlDBPrivateDnsZoneId string = privatezone_sqldb.outputs.privateDnsZoneId
698713
output amlApiPrivateDnsZoneId string = privatezone_azureml_api.outputs.privateDnsZoneId
699714
output amlNotebooksPrivateDnsZoneId string = privatezone_azureml_notebook.outputs.privateDnsZoneId
700715
output aksPrivateDnsZoneId string = privatezone_aks.outputs.privateDnsZoneId
716+
output asPrivateDnsZoneId string = privatezone_as.outputs.privateDnsZoneId
701717

702718
output aksUdrNAme string = udrAKS.name

schemas/latest/landingzones/types/appServiceLinuxContainer.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,20 @@
2222
},
2323
"skuTier": {
2424
"type": "string"
25+
},
26+
"enablePrivateEndpoint": {
27+
"type": "boolean",
28+
"enum": [
29+
true,
30+
false
31+
]
2532
}
2633
},
2734
"required": [
2835
"enabled",
2936
"skuName",
30-
"skuTier"
37+
"skuTier",
38+
"enablePrivateEndpoint"
3139
]
3240
},
3341
{

0 commit comments

Comments
 (0)