-
Notifications
You must be signed in to change notification settings - Fork 2
/
azuredeploy.application.bicep
110 lines (98 loc) · 3.47 KB
/
azuredeploy.application.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
@description('The prefix will be used for every parameter that represents a resource name')
param resourceNamePrefix string = 'customer-project'
@description('The suffix will be appended to every parameter that represents a resource name')
param resourceNameSuffix string
param resourceLocation string = resourceGroup().location
param keyVaultName string
param keyVaultResourceGroupName string
param keyVaultSecretNameStorageAccountConnectionString string = 'storageAccountConnectionString'
param keyVaultSecretNameServiceBusConnectionString string = 'serviceBusConnectionString'
param keyVaultSecretNameSignalRConnectionString string = 'signalRConnectionString'
@secure()
param appInsightsConnectionString string = ''
var appServicePlanName = '${resourceNamePrefix}-asp-${resourceNameSuffix}'
var appServicePlanSku = {
name: 'Y1'
tier: 'Dynamic'
}
var serviceFuncName = '${resourceNamePrefix}-service-f-${resourceNameSuffix}'
resource partnerIdRes 'Microsoft.Resources/deployments@2020-06-01' = {
name: 'pid-d16e7b59-716a-407d-96db-18d1cac40407'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
resources: []
}
}
}
resource appServicePlanRes 'Microsoft.Web/serverfarms@2020-09-01' = {
name: appServicePlanName
location: resourceLocation
sku: appServicePlanSku
properties: {}
}
resource serviceFuncRes 'Microsoft.Web/sites@2021-03-01' = {
name: serviceFuncName
location: resourceLocation
kind: 'functionapp'
properties: {
enabled: true
hostNameSslStates: [
{
name: '${serviceFuncName}.azurewebsites.net'
sslState: 'Disabled'
hostType: 'Standard'
}
{
name: '${serviceFuncName}.scm.azurewebsites.net'
sslState: 'Disabled'
hostType: 'Repository'
}
]
serverFarmId: appServicePlanRes.id
clientAffinityEnabled: true
containerSize: 1536
dailyMemoryTimeQuota: 0
httpsOnly: true
siteConfig: {
cors: {
allowedOrigins: [
'*'
]
}
ftpsState: 'Disabled'
}
}
identity: {
type: 'SystemAssigned'
}
}
resource keyVaultRes 'Microsoft.KeyVault/vaults@2022-07-01' existing = if (!empty(keyVaultName) && !empty(keyVaultResourceGroupName)) {
name: keyVaultName
scope: resourceGroup(keyVaultResourceGroupName)
}
module serviceFuncAppSettingsRes './modules.funcAppSettings.bicep' = if (!empty(keyVaultName) && !empty(keyVaultResourceGroupName)) {
name: 'func-appsettings'
params: {
keyVaultName: keyVaultName
serviceFuncName: serviceFuncName
storageAccountConnectionString: keyVaultRes.getSecret(keyVaultSecretNameStorageAccountConnectionString)
appInsightsConnectionString: appInsightsConnectionString
keyVaultSecretNameServiceBusConnectionString: keyVaultSecretNameServiceBusConnectionString
keyVaultSecretNameSignalRConnectionString: keyVaultSecretNameSignalRConnectionString
keyVaultSecretNameStorageAccountConnectionString: keyVaultSecretNameStorageAccountConnectionString
}
dependsOn: [
keyVaultAccessPolicyRes
]
}
module keyVaultAccessPolicyRes './modules.keyVaultAccessPolicy.bicep' = if (!empty(keyVaultName) && !empty(keyVaultResourceGroupName)) {
name: 'keyvault-accesspolicy-service'
scope: resourceGroup(keyVaultResourceGroupName)
params: {
keyVaultName: keyVaultName
principalId: reference(serviceFuncRes.id, '2021-03-01', 'Full').identity.principalId
}
}