-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-service-spa.bicep
More file actions
79 lines (66 loc) · 2.21 KB
/
app-service-spa.bicep
File metadata and controls
79 lines (66 loc) · 2.21 KB
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
// ---------------------------------------------------------------------------
// app-service-spa.bicep — Node 20 App Service for Angular SPA
// ---------------------------------------------------------------------------
@description('Name of the SPA App Service.')
param name string
@description('Azure region.')
param location string
@description('Resource ID of the App Service Plan.')
param appServicePlanId string
@description('SPA app registration client ID from Entra ID.')
param spaClientId string
@description('Microsoft Entra ID tenant ID.')
param tenantId string
@description('Base URL of the API App Service.')
param apiBaseUrl string
@description('Application Insights connection string.')
param appInsightsConnectionString string
@description('Resource ID of the subnet for App Service Regional VNet integration. Empty string disables integration.')
param virtualNetworkSubnetId string = ''
@description('Resource tags.')
param tags object = {}
var enableVnetIntegration = !empty(virtualNetworkSubnetId)
resource spaApp 'Microsoft.Web/sites@2023-12-01' = {
name: name
location: location
tags: tags
identity: {
type: 'SystemAssigned'
}
properties: {
serverFarmId: appServicePlanId
httpsOnly: true
virtualNetworkSubnetId: enableVnetIntegration ? virtualNetworkSubnetId : null
publicNetworkAccess: 'Enabled'
siteConfig: {
linuxFxVersion: 'NODE|20-lts'
appCommandLine: 'pm2 serve /home/site/wwwroot --spa --no-daemon'
alwaysOn: true
ftpsState: 'Disabled'
minTlsVersion: '1.2'
vnetRouteAllEnabled: enableVnetIntegration
appSettings: [
{
name: 'MSAL_CLIENT_ID'
value: spaClientId
}
{
name: 'MSAL_TENANT_ID'
value: tenantId
}
{
name: 'API_BASE_URL'
value: apiBaseUrl
}
{
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
value: appInsightsConnectionString
}
]
}
}
}
@description('Default hostname of the SPA App Service.')
output hostname string = spaApp.properties.defaultHostName
@description('Principal ID of the system-assigned Managed Identity.')
output principalId string = spaApp.identity.principalId