-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
param privateEndpointName string | ||
param appResourceGroupName string | ||
param privateDnsZoneName string | ||
param appName string | ||
|
||
|
||
resource privateEndpoint 'Microsoft.Network/privateEndpoints@2023-05-01' existing = { | ||
name: privateEndpointName | ||
scope: resourceGroup(appResourceGroupName) | ||
} | ||
resource privateDNSZone 'Microsoft.Network/privateDnsZones@2020-06-01' existing = { | ||
name: privateDnsZoneName | ||
} | ||
|
||
resource privateDNSRecordSet 'Microsoft.Network/privateDnsZones/A@2020-06-01' = { | ||
name: appName | ||
parent: privateDNSZone | ||
properties: { | ||
ttl: 3600 | ||
aRecords: [ | ||
{ | ||
ipv4Address: privateEndpoint.properties.customDnsConfigs[0].ipAddresses[0] | ||
} | ||
] | ||
} | ||
} | ||
|
||
resource privateDNSRecordSetScm 'Microsoft.Network/privateDnsZones/A@2020-06-01' = { | ||
name: '${appName}.scm' | ||
parent: privateDNSZone | ||
properties: { | ||
ttl: 3600 | ||
aRecords: [ | ||
{ | ||
ipv4Address: privateEndpoint.properties.customDnsConfigs[0].ipAddresses[0] | ||
} | ||
] | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
param location string | ||
param appName string | ||
param rgSharedResources string | ||
param aspName string | ||
param privateDnsZoneName string | ||
param vnetName string | ||
param subnetName string | ||
param connectivitySubnet string | ||
param stackVersion string | ||
param startCommand string | ||
|
||
|
||
resource appServicePlan 'Microsoft.Web/serverfarms@2021-01-15' existing = { | ||
name: aspName | ||
scope: resourceGroup(rgSharedResources) | ||
} | ||
|
||
resource AppServiceApp 'Microsoft.Web/sites@2021-01-15' = { | ||
name: appName | ||
location: location | ||
identity: { | ||
type: 'SystemAssigned' | ||
} | ||
|
||
properties: { | ||
serverFarmId: appServicePlan.id | ||
httpsOnly: true | ||
clientAffinityEnabled: false | ||
virtualNetworkSubnetId: resourceId(rgSharedResources,'Microsoft.Network/virtualNetworks/subnets', vnetName, connectivitySubnet) | ||
siteConfig: { | ||
linuxFxVersion: stackVersion | ||
appCommandLine: startCommand | ||
appSettings: [ | ||
{ | ||
name: 'WEBSITE_WEBDEPLOY_USE_SCM' | ||
value: 'false' | ||
} | ||
{ | ||
name: 'SCM_DO_BUILD_DURING_DEPLOYMENT' | ||
value: 'false' | ||
} | ||
] | ||
} | ||
} | ||
} | ||
|
||
resource stagingSlot 'Microsoft.Web/sites/slots@2021-02-01' = { | ||
name: 'staging' | ||
parent: AppServiceApp | ||
location: location | ||
kind: 'app' | ||
identity: { | ||
type: 'SystemAssigned' | ||
} | ||
properties: { | ||
serverFarmId: appServicePlan.id | ||
} | ||
} | ||
|
||
var privateEndpointName = 'pe-${appName}' | ||
|
||
resource privateEndpoint 'Microsoft.Network/privateEndpoints@2023-05-01' = { | ||
name: privateEndpointName | ||
location: location | ||
properties: { | ||
subnet: { | ||
id: resourceId(rgSharedResources,'Microsoft.Network/virtualNetworks/subnets', vnetName, subnetName) | ||
} | ||
privateLinkServiceConnections: [ | ||
{ | ||
name: privateEndpointName | ||
properties: { | ||
groupIds: ['sites'] | ||
privateLinkServiceId: AppServiceApp.id | ||
} | ||
} | ||
] | ||
} | ||
} | ||
|
||
module addToPrivateDns 'AddToPrivateDns.bicep' = { | ||
name: 'addToPrivateDns' | ||
params: { | ||
privateDnsZoneName: privateDnsZoneName | ||
privateEndpointName: privateEndpointName | ||
appResourceGroupName: resourceGroup().name | ||
appName: appName | ||
} | ||
dependsOn: [privateEndpoint] | ||
scope: resourceGroup(rgSharedResources) | ||
} | ||
|