-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.bicep
More file actions
138 lines (118 loc) · 4.79 KB
/
Copy pathmain.bicep
File metadata and controls
138 lines (118 loc) · 4.79 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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// =============================================================================
// main.bicep — Talent Management full-stack Azure infrastructure
// =============================================================================
// Provisions all resources for the AngularNetTutorial three-tier stack:
// - App Service Plan (B1, shared)
// - Web App: Talent Management API
// - Web App: Duende IdentityServer
// - Static Web App: Angular client (Free tier)
// - Azure SQL logical server (shared)
// - SQL database: TalentManagementApiDb
// - SQL database: IdentityServerDb
//
// Deploy command (from repo root):
// az deployment group create \
// --resource-group rg-talent-dev \
// --template-file infra/main.bicep \
// --parameters infra/parameters/dev.bicepparam \
// --parameters sqlAdminPassword=$SQL_ADMIN_PASSWORD
// =============================================================================
@description('Azure region for all resources')
param location string = resourceGroup().location
@description('Name of the App Service Plan')
param appServicePlanName string
@description('Name of the API Web App')
param apiAppName string
@description('Name of the IdentityServer Web App')
param identityAppName string
@description('Name of the IdentityServer Admin Web App')
param identityAdminAppName string
@description('Name of the Angular Static Web App')
param staticWebAppName string
@description('Name of the Azure SQL logical server')
param sqlServerName string
@description('Name of the API database')
param apiDbName string
@description('Name of the IdentityServer database')
param identityDbName string
@description('SQL administrator login name')
param sqlAdminLogin string
@description('SQL administrator password — pass from GitHub Secret, never store in parameters file')
@secure()
param sqlAdminPassword string
@description('Name of the Azure Key Vault')
param keyVaultName string
// ─── App Service Plan ─────────────────────────────────────────────────────────
module appServicePlan 'modules/appServicePlan.bicep' = {
name: 'appServicePlan'
params: {
appServicePlanName: appServicePlanName
location: location
}
}
// ─── Web Apps ─────────────────────────────────────────────────────────────────
module apiApp 'modules/webApp.bicep' = {
name: 'apiApp'
params: {
webAppName: apiAppName
location: location
appServicePlanId: appServicePlan.outputs.id
}
}
module identityApp 'modules/webApp.bicep' = {
name: 'identityApp'
params: {
webAppName: identityAppName
location: location
appServicePlanId: appServicePlan.outputs.id
}
}
module identityAdminApp 'modules/webApp.bicep' = {
name: 'identityAdminApp'
params: {
webAppName: identityAdminAppName
location: location
appServicePlanId: appServicePlan.outputs.id
}
}
// ─── Angular Static Web App ───────────────────────────────────────────────────
// Static Web Apps are not available in eastus — use eastus2
module angularSwa 'modules/staticWebApp.bicep' = {
name: 'angularSwa'
params: {
staticWebAppName: staticWebAppName
location: 'westus2'
}
}
// ─── SQL Server + Databases ───────────────────────────────────────────────────
module sqlServer 'modules/sqlServer.bicep' = {
name: 'sqlServer'
params: {
sqlServerName: sqlServerName
location: location
sqlAdminLogin: sqlAdminLogin
sqlAdminPassword: sqlAdminPassword
apiDbName: apiDbName
identityDbName: identityDbName
}
}
// ─── Key Vault ────────────────────────────────────────────────────────────────
module keyVault 'modules/keyVault.bicep' = {
name: 'keyVault'
params: {
keyVaultName: keyVaultName
location: location
readerPrincipalIds: [
apiApp.outputs.principalId
identityApp.outputs.principalId
identityAdminApp.outputs.principalId
]
}
}
// ─── Outputs (used by deployment workflows and post-deployment config) ─────────
output apiAppUrl string = apiApp.outputs.url
output identityAppUrl string = identityApp.outputs.url
output identityAdminAppUrl string = identityAdminApp.outputs.url
output angularAppUrl string = angularSwa.outputs.url
output sqlServerFqdn string = sqlServer.outputs.sqlServerFqdn
output keyVaultUri string = keyVault.outputs.uri