Skip to content

Commit d18bc94

Browse files
authored
Merge pull request Azure#54 from Azure/tj/feature/bicep-docs
Add Bicep Docs
2 parents 6bf780c + 3933a19 commit d18bc94

17 files changed

Lines changed: 251 additions & 114 deletions

bicep/main.bicep

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ param sendGridKeySecretValue string
9494
param secretStoreComponentName string
9595

9696
@description('The key vault name store secrets')
97-
param keyVaultName string
97+
param keyVaultName string = '${prefix}kv-${uniqueString(resourceGroup().id)}${suffix}'
9898

9999
// Container Registry & Images
100100
@description('The name of the container registry.')
@@ -112,23 +112,14 @@ param containerRegistryPasswordRefName string
112112
param containerRegistryPassword string
113113

114114
@description('The image for the backend processor service.')
115-
param backendProcessoServiceImage string
115+
param backendProcessorServiceImage string
116116

117117
@description('The image for the backend api service.')
118118
param backendApiServiceImage string
119119

120120
@description('The image for the frontend web app service.')
121121
param frontendWebAppServiceImage string
122122

123-
124-
// ------------------
125-
// VARIABLES
126-
// ------------------
127-
128-
// var keyVaultIdTokens = split(keyVaultId, '/')
129-
// var keyVaultName = keyVaultIdTokens[8]
130-
131-
132123
// ------------------
133124
// RESOURCES
134125
// ------------------
@@ -141,8 +132,6 @@ module containerAppsEnvironment 'modules/container-apps-environment.bicep' ={
141132
applicationInsightName: applicationInsightName
142133
location: location
143134
tags: tags
144-
prefix: prefix
145-
suffix: suffix
146135
}
147136
}
148137

@@ -164,7 +153,6 @@ module serviceBus 'modules/service-bus.bicep' = {
164153
serviceBusTopicName: serviceBusTopicName
165154
serviceBusTopicAuthorizationRuleName: serviceBusTopicAuthorizationRuleName
166155
backendProcessorServiceName: backendProcessorServiceName
167-
168156
}
169157
}
170158

@@ -175,8 +163,7 @@ module cosmosDb 'modules/cosmos-db.bicep' = {
175163
location: location
176164
tags: tags
177165
cosmosDbDatabaseName: cosmosDbDatabaseName
178-
cosmosDbCollectionName: cosmosDbCollectionName
179-
166+
cosmosDbCollectionName: cosmosDbCollectionName
180167
}
181168
}
182169

@@ -236,7 +223,7 @@ module containerApps 'modules/container-apps.bicep' = {
236223
cosmosDbDatabaseName: cosmosDb.outputs.cosmosDbDatabaseName
237224
cosmosDbCollectionName: cosmosDb.outputs.cosmosDbCollectionName
238225
containerRegistryName: containerRegistryName
239-
backendProcessoServiceImage: backendProcessoServiceImage
226+
backendProcessorServiceImage: backendProcessorServiceImage
240227
backendApiServiceImage: backendApiServiceImage
241228
frontendWebAppServiceImage: frontendWebAppServiceImage
242229
sendGridKeySecretName: sendGridKeySecretName

bicep/main.parameters.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@
5959
"secretStoreComponentName": {
6060
"value": "secretstoreakv"
6161
},
62-
"keyVaultName": {
63-
"value": "tasks-tracker-akv-4"
64-
},
6562
"containerRegistryName": {
6663
"value": "<CONTAINER_REGISTRY_NAME>"
6764
},

bicep/modules/container-apps-environment.bicep

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,17 @@ targetScope = 'resourceGroup'
66
@description('The location where the resources will be created.')
77
param location string = resourceGroup().location
88

9-
@description('Optional. The prefix to be used for all resources created by this template.')
10-
param prefix string = ''
11-
12-
@description('Optional. The suffix to be used for all resources created by this template.')
13-
param suffix string = ''
14-
159
@description('Optional. The tags to be assigned to the created resources.')
1610
param tags object = {}
1711

18-
@description('Optional. The name of the container apps environment. If set, it overrides the name generated by the template.')
19-
param containerAppsEnvironmentName string = '${prefix}cae-${uniqueString(resourceGroup().id)}${suffix}'
12+
@description('The name of the container apps environment. If set, it overrides the name generated by the template.')
13+
param containerAppsEnvironmentName string
2014

21-
@description('Optional. The name of the log analytics workspace. If set, it overrides the name generated by the template.')
22-
param logAnalyticsWorkspaceName string = '${prefix}log-${uniqueString(resourceGroup().id)}${suffix}'
15+
@description('The name of the log analytics workspace. If set, it overrides the name generated by the template.')
16+
param logAnalyticsWorkspaceName string
2317

24-
@description('Optional. The name of the application insights. If set, it overrides the name generated by the template.')
25-
param applicationInsightName string = '${prefix}appi-${uniqueString(resourceGroup().id)}${suffix}'
18+
@description(' The name of the application insights. If set, it overrides the name generated by the template.')
19+
param applicationInsightName string
2620

2721
// ------------------
2822
// VARIABLES
@@ -81,11 +75,5 @@ resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2022-10-01'
8175
// OUTPUTS
8276
// ------------------
8377

84-
@description('The resource ID of the container apps environment.')
85-
output containerAppsEnvironmentId string = containerAppsEnvironment.id
86-
87-
@description('The name of the container apps environment.')
88-
output containerAppsEnvironmentName string = containerAppsEnvironment.name
89-
9078
@description('The name of the application insights.')
9179
output applicationInsightsName string = applicationInsights.name

bicep/modules/container-apps.bicep

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ targetScope = 'resourceGroup'
77
@description('The location where the resources will be created.')
88
param location string = resourceGroup().location
99

10-
@description('Optional. The tags to be assigned to the created resources.')
10+
@description('The tags to be assigned to the created resources.')
1111
param tags object = {}
1212

1313
@description('The name of the container apps environment.')
@@ -79,7 +79,7 @@ param containerRegistryPassword string
7979
param backendApiServiceImage string
8080

8181
@description('The image for the backend processor service.')
82-
param backendProcessoServiceImage string
82+
param backendProcessorServiceImage string
8383

8484
@description('The image for the frontend web app service.')
8585
param frontendWebAppServiceImage string
@@ -156,7 +156,7 @@ module backendProcessorService 'container-apps/processor-backend-service.bicep'
156156
sendGridKeySecretValue: sendGridKeySecretValue
157157
externalStorageAccountName: externalStorageAccountName
158158
externalStorageKeySecretName:externalStorageKeySecretName
159-
backendProcessoServiceImage: backendProcessoServiceImage
159+
backendProcessorServiceImage: backendProcessorServiceImage
160160
appInsightsInstrumentationKey: applicationInsights.properties.InstrumentationKey
161161
}
162162
}

bicep/modules/container-apps/processor-backend-service.bicep

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ param externalStorageKeySecretName string
3636
@description('The Application Insights Instrumentation.')
3737
param appInsightsInstrumentationKey string
3838

39-
// @secure()
40-
// @description('The External Azure Stroage Access key for the Backend Background Processor Service.')
41-
// param externalAzureStroageKeySecretValue string
42-
4339
// Service Bus
4440
@description('The name of the service bus namespace.')
4541
param serviceBusName string
@@ -70,7 +66,7 @@ param containerRegistryPasswordRefName string
7066
param containerRegistryPassword string
7167

7268
@description('The image for the backend processor service.')
73-
param backendProcessoServiceImage string
69+
param backendProcessorServiceImage string
7470

7571

7672
// ------------------
@@ -82,9 +78,6 @@ var keyVaultSubscriptionId = keyVaultIdTokens[2]
8278
var keyVaultResourceGroupName = keyVaultIdTokens[4]
8379
var keyVaultName = keyVaultIdTokens[8]
8480

85-
// var containerAppName = 'ca-${backendProcessorServiceName}'
86-
var containerAppName = backendProcessorServiceName
87-
8881
// ------------------
8982
// RESOURCES
9083
// ------------------
@@ -109,7 +102,7 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2021-09-01' existing
109102
}
110103

111104
resource backendProcessorService 'Microsoft.App/containerApps@2022-06-01-preview' = {
112-
name: containerAppName
105+
name: backendProcessorServiceName
113106
location: location
114107
tags: tags
115108
identity: {
@@ -153,7 +146,7 @@ resource backendProcessorService 'Microsoft.App/containerApps@2022-06-01-preview
153146
containers: [
154147
{
155148
name: backendProcessorServiceName
156-
image: backendProcessoServiceImage
149+
image: backendProcessorServiceImage
157150
resources: {
158151
cpu: json('0.25')
159152
memory: '0.5Gi'
@@ -200,8 +193,6 @@ resource backendProcessorService 'Microsoft.App/containerApps@2022-06-01-preview
200193
}
201194

202195

203-
204-
205196
// Enable consume from servicebus using system managed identity.
206197
resource backendProcessorService_sb_role_assignment 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
207198
name: guid(resourceGroup().id, backendProcessorServiceName, '4f6d3b9b-027b-4f4c-9142-0e5a2a2247e0')
@@ -210,11 +201,10 @@ resource backendProcessorService_sb_role_assignment 'Microsoft.Authorization/rol
210201
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', '4f6d3b9b-027b-4f4c-9142-0e5a2a2247e0') // Azure Service Bus Data Receiver.
211202
principalType: 'ServicePrincipal'
212203
}
213-
//scope: serviceBusTopicSubscription
214204
scope: serviceBusNamespace
215205
}
216206

217-
// Create secrets and assigne Secrets User role to the backend processor service
207+
// Invoke create secrets and assign role 'Azure Role Key Vault Secrets User' to the backend processor service
218208
module backendProcessorKeySecret 'secrets/processor-backend-service-secrets.bicep' = {
219209
name: 'backendProcessorKeySecret-${uniqueString(resourceGroup().id)}'
220210
params: {

bicep/modules/container-apps/secrets/processor-backend-service-secrets.bicep

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ resource sendGridKeySecret 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = {
5151
}
5252
}
5353

54-
// External Azure Stroage key secret used by Backend Background Processor Service.
54+
// External Azure storage key secret used by Backend Background Processor Service.
5555
resource externalAzureStorageKeySecret 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = {
5656
parent: keyVault
5757
tags: tags
@@ -61,7 +61,6 @@ resource externalAzureStorageKeySecret 'Microsoft.KeyVault/vaults/secrets@2022-0
6161
}
6262
}
6363

64-
//Changed scope to the enture key valut not 1 secret
6564
resource keyVaultSecretUserRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
6665
name: guid(subscription().id, keyVault.id, backendProcessorServicePrincipalId, keyVaultSecretUserRoleGuid)
6766
scope: keyVault

bicep/modules/container-apps/webapi-backend-service.bicep

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@ param backendApiServiceImage string
5555
@description('The Application Insights Instrumentation.')
5656
param appInsightsInstrumentationKey string
5757

58-
// ------------------
59-
// VARIABLES
60-
// ------------------
61-
62-
// var containerAppName = 'ca-${backendApiServiceName}'
63-
var containerAppName = backendApiServiceName
64-
6558
// ------------------
6659
// RESOURCES
6760
// ------------------
@@ -77,7 +70,6 @@ resource serviceBusTopic 'Microsoft.ServiceBus/namespaces/topics@2021-11-01' exi
7770

7871
resource cosmosDbAccount 'Microsoft.DocumentDB/databaseAccounts@2022-08-15' existing = {
7972
name: cosmosDbName
80-
8173
}
8274

8375
resource cosmosDbDatabase 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2021-04-15' existing = {
@@ -91,7 +83,7 @@ resource cosmosDbDatabaseCollection 'Microsoft.DocumentDB/databaseAccounts/sqlDa
9183
}
9284

9385
resource backendApiService 'Microsoft.App/containerApps@2022-06-01-preview' = {
94-
name: containerAppName
86+
name: backendApiServiceName
9587
location: location
9688
tags: tags
9789
identity: {
@@ -168,15 +160,14 @@ resource backendApiService_cosmosdb_role_assignment 'Microsoft.DocumentDB/databa
168160
}
169161
}
170162

171-
// Enable send to servicebus using app managed identity.
163+
// Enable publish message to Service Bus using app managed identity.
172164
resource backendApiService_sb_role_assignment 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
173165
name: guid(resourceGroup().id, backendApiService.name, '69a216fc-b8fb-44d8-bc22-1f3c2cd27a39')
174166
properties: {
175167
principalId: backendApiService.identity.principalId
176168
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', '69a216fc-b8fb-44d8-bc22-1f3c2cd27a39')//Azure Service Bus Data Sender
177169
principalType: 'ServicePrincipal'
178170
}
179-
180171
scope: serviceBusTopic
181172
}
182173

bicep/modules/container-apps/webapp-frontend-service.bicep

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,16 @@ param containerRegistryPassword string
3434
@description('The image for the frontend web app service.')
3535
param frontendWebAppServiceImage string
3636

37-
3837
@secure()
3938
@description('The Application Insights Instrumentation.')
4039
param appInsightsInstrumentationKey string
4140

42-
// ------------------
43-
// VARIABLES
44-
// ------------------
45-
46-
// var containerAppName = 'ca-${frontendWebAppServiceName}'
47-
var containerAppName = frontendWebAppServiceName
48-
4941
// ------------------
5042
// RESOURCES
5143
// ------------------
5244

5345
resource frontendWebAppService 'Microsoft.App/containerApps@2022-06-01-preview' = {
54-
name: containerAppName
46+
name: frontendWebAppServiceName
5547
location: location
5648
tags: tags
5749
properties: {

bicep/modules/cosmos-db.bicep

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ param cosmosDbDatabaseName string
1919
@description('The name of Cosmos DB\'s collection.')
2020
param cosmosDbCollectionName string
2121

22-
23-
// ------------------
24-
// VARIABLES
25-
// ------------------
26-
27-
2822
// ------------------
2923
// RESOURCES
3024
// ------------------
@@ -89,5 +83,3 @@ output cosmosDbName string = cosmosDbAccount.name
8983
output cosmosDbDatabaseName string = cosmosDbDatabase.name
9084
@description('The name of Cosmos DB\'s collection.')
9185
output cosmosDbCollectionName string = cosmosDbDatabaseCollection.name
92-
@description('The document endpoint of Cosmos DB\'s account.')
93-
output cosmosDbDocumentEndpoint string = cosmosDbAccount.properties.documentEndpoint

bicep/modules/dapr-components.bicep

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ resource cosmosDbAccount 'Microsoft.DocumentDB/databaseAccounts@2022-08-15' exis
6969
name: cosmosDbName
7070
}
7171

72-
//Secret Store
72+
//Secret Store Component
7373
resource secretstoreComponent 'Microsoft.App/managedEnvironments/daprComponents@2022-03-01' = {
7474
name: secretStoreComponentName
7575
parent: containerAppsEnvironment
@@ -89,7 +89,7 @@ resource secretstoreComponent 'Microsoft.App/managedEnvironments/daprComponents@
8989
}
9090
}
9191

92-
//Cosmos DB State Store
92+
//Cosmos DB State Store Component
9393
resource statestoreComponent 'Microsoft.App/managedEnvironments/daprComponents@2022-06-01-preview' = {
9494
name: 'statestore'
9595
parent: containerAppsEnvironment
@@ -118,7 +118,7 @@ resource statestoreComponent 'Microsoft.App/managedEnvironments/daprComponents@2
118118
}
119119
}
120120

121-
//PubSub service bus
121+
//PubSub service bus Component
122122
resource pubsubComponent 'Microsoft.App/managedEnvironments/daprComponents@2022-06-01-preview' = {
123123
name: 'dapr-pubsub-servicebus'
124124
parent: containerAppsEnvironment

0 commit comments

Comments
 (0)