You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -40,7 +40,13 @@ To begin, we need to define the Bicep modules that will be required to generate
40
40
To proceed, you must install an extension called [Bicep](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep). This extension will simplify building Bicep files as it offers IntelliSense, Validation, listing all available resource types, etc..
41
41
42
42
#### 2. Define an Azure Container Apps Environment
43
-
Add a new folder named `bicep` on the root project directory, then add another folder named `modules`. Add a new file named `container-apps-environment.bicep`. The content of the file can be found [at this location](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/container-apps-environment.bicep).
43
+
Add a new folder named `bicep` on the root project directory, then add another folder named `modules`. Add file as shown below:
??? tip "What we've added in the Bicep file above"
46
52
- The module takes multiple parameters, all of which are set to default values. This indicates that if no value is specified, the default value will be utilized.
@@ -53,44 +59,76 @@ Add a new folder named `bicep` on the root project directory, then add another f
53
59
- The output of this module are a is parameter named `applicationInsightsName`. This output is needed as an input for a subsequent module.
54
60
55
61
#### 3. Define an Azure Key Vault Resource
56
-
Add a new file named `key-vault.bicep` under the folder `bicep\modules`. The content of the file can be found [at this location](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/key-vault.bicep).
62
+
63
+
Add file as shown below under the folder `bicep\modules`:
??? tip "What we've added in the Bicep file above"
59
72
- This module will create the Azure Key Vault resource which will be used to store secrets.
60
73
- The output of this module is a single parameter named `keyVaultId`. This output is needed as an input for a subsequent module.
61
74
62
75
#### 4. Define a Azure Service Bus Resource
63
-
Add a new file named `service-bus.bicep` under the folder `bicep\modules`. The content of the file can be found [at this location](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/service-bus.bicep).
76
+
77
+
Add file as shown below under the folder `bicep\modules`:
??? tip "What we've added in the Bicep file above"
66
86
- This module will create the Azure Service resource, a topic, a subscription for the consumer, and an authorization rule with `Manage` permissions.
67
87
- The output of this module will return three output parameters which will be used as an input for a subsequent module.
68
88
69
89
#### 5. Define an Azure CosmosDb Resource
70
90
71
-
Add a new file named `cosmos-db.bicep` under the folder `bicep\modules`. The content of the file can be found [at this location](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/cosmos-db.bicep)
91
+
Add file as shown below under the folder `bicep\modules`:
??? tip "What we've added in the Bicep file above"
74
100
- This module will create the Azure CosmosDB account, a CosmosDB database, and a CosmosDB collection.
75
101
- The output of this module will return three output parameters which will be used as an input for a subsequent module.
76
102
77
103
#### 6. Define an Azure Storage Resource
78
104
79
-
Add a new file named `storage-account.bicep` under the folder `bicep\modules`. The content of the file can be found [at this location](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/storage-account.bicep)
105
+
Add file as shown below under the folder `bicep\modules`:
??? tip "What we've added in the Bicep file above"
82
114
- This module will create the Azure Storage account, a storage queue service, and a queue.
83
115
- The output of this module will be a single output parameter which will be used as an input for a subsequent module.
84
116
85
117
#### 7. Define Dapr Components
86
118
87
-
Next we will define all dapr components used in the solution in a single bicep module. To accomplish this, add a new file called `dapr-components.bicep` under the folder `bicep\modules`. The content of the file can be found [at this location](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/dapr-components.bicep)
119
+
Next we will define all dapr components used in the solution in a single bicep module. To accomplish this, add a new file under the folder `bicep\modules` as shown below:
??? tip "What we've added in the Bicep file above"
90
128
- This module will be responsible for creating all dapr components used in the solution. It accepts various input parameters needed by the dapr components.
91
129
- Notice how we are using the keyword `existing` to obtain a strongly typed reference to the pre-created resource
@@ -101,21 +139,41 @@ Next we will define all dapr components used in the solution in a single bicep m
101
139
```
102
140
103
141
#### 8. Create Secrets Into Azure Key Vault
142
+
104
143
This module will have the responsibility of generating the secrets and saving them in Azure Key Vault. Additionally, it will establish a role assignment for the backend processor service, specifically of type `Azure Role Key Vault Secrets User`, which will allow the service to access the Key Vault and retrieve the secrets.
105
144
106
-
To achieve this, create a new directory called `container-apps\secrets` within the `modules` folder, and subsequently, introduce a new file named `processor-backend-service-secrets.bicep` within the `container-apps\secrets` folder. The content of the file can be found [at this location](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/container-apps/secrets/processor-backend-service-secrets.bicep).
145
+
To achieve this, create a new directory called `container-apps\secrets` within the `modules` folder. Add new file as shown below under the folder `bicep\modules\container-apps\secrets`:
#### 9. Define the Frontend Service Azure Container App
109
-
We will now begin defining the modules that are necessary for producing the container apps, starting with the Frontend App. To initiate this process, create a new file named `webapp-frontend-service.bicep` within the `modules\container-apps` directory. The content of the file can be found [at this location](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/container-apps/webapp-frontend-service.bicep).
154
+
We will now begin defining the modules that are necessary for producing the container apps, starting with the Frontend App. To initiate this process, add a new file under the folder `bicep\modules\container-apps` as shown below:
??? tip "What we've added in the Bicep file above"
112
163
- Observe the usage of the `@secure` attribute on input parameters that contain confidential information or keys. This attribute may be applied to both string and object parameters that encompass secretive values. By implementing this attribute, Azure will abstain from presenting the parameter values within the deployment logs or on the terminal if you happen to be utilizing Azure CLI.
113
164
- The output parameters of this module will provide the fully qualified domain name (FQDN) for the frontend container application.
114
165
115
166
#### 10. Define the Backend Api Service Azure Container App
116
-
Add a new file named `webapi-backend-service.bicep` under the folder `modules\container-apps`. The content of the file can be found [at this location](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/container-apps/webapi-backend-service.bicep).
167
+
Add a new file under the folder `bicep\modules\container-apps` as shown below:
??? tip "What we've added in the Bicep file above"
176
+
119
177
- Notice how we are assigning the Cosmosdb account a read/write access using the `Cosmos DB Built-in Data Contributor` role to the Backend API system assigned identity, by using the code below:
120
178
121
179
```Shell
@@ -142,9 +200,17 @@ Add a new file named `webapi-backend-service.bicep` under the folder `modules\co
142
200
```
143
201
144
202
#### 11. Define the Backend Processor Service Azure Container App
145
-
Add a new file named `processor-backend-service.bicep` under the folder `modules\container-apps`. The content of the file can be found [at this location](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/container-apps/processor-backend-service.bicep).
203
+
204
+
Add a new file under the folder `bicep\modules\container-apps` as shown below:
??? tip "What we've added in the Bicep file above"
213
+
148
214
- Notice how we are assigning the role `Azure Service Bus Data Receiver` to the Backend Processor to be able to consume/read messages from Azure Service Bus Topic using Backend Processor system assigned identity, by using the code below:
#### 12. Define a Container Module For the Three Container Apps
176
-
This module will act as a container for the three Container Apps modules defined in the previous three steps. It is optional to create it, but it makes it easier when we invoke all the created modules as you will see in the next step. To create this module add a new file named `container-apps.bicep` under the folder `modules`. The content of the file can be found [at this location](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/container-apps.bicep).
243
+
This module will act as a container for the three Container Apps modules defined in the previous three steps. It is optional to create it, but it makes it easier when we invoke all the created modules as you
244
+
will see in the next step.
245
+
246
+
Add a new file under the folder `bicep\modules` as shown below:
Finally, we must specify the Main Bicep module that will connect all other modules together. This file will be referenced by the AZ CLI command when producing all resources. To achieve this, add a new file named `main.bicep` under the `bicep` directory. The contents of the file can be found at this [location](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/main.bicep).
255
+
Finally, we must specify the Main Bicep module that will connect all other modules together. This file will be referenced by the AZ CLI command when producing all resources.
256
+
257
+
To achieve this, add a new file under the `bicep` directory as shown below:
??? tip "What we've added in the Bicep file above"
182
266
@@ -185,9 +269,23 @@ Finally, we must specify the Main Bicep module that will connect all other modul
185
269
- When calling the module `container-apps.bicep`, some of the input params are expecting are referencing another resource, for example consider the input param named `cosmosDbName` and the value used is `cosmosDb.outputs.cosmosDbName`. This means that the module `cosmos-db.bicep` should be created successfully before creating the container apps module, this called Implicit dependency.
186
270
187
271
### Deploy the Infrastructure and Create the Components
188
-
With the steps above completed we are ready to deploy all the different resources. We just need to create a parameters file which will simplify the invocation of the main bicep file. To achieve this, right click on file `main.bicep` and select `Generate Parameter File`. This will result in creating a file named `main.parameters.json` similar to the file found [here](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/main.parameters.json).
189
272
190
-
To use this file, you need to edit this generated file and provide values for the parameters. You can use the same values provided on the github link. You only need to replace parameter values between the angle brackets `<>` with values related to your ACR resource and SendGrid.
273
+
With the steps above completed we are ready to deploy all the different resources. We just need to create a parameters file which will simplify the invocation of the main bicep file.
274
+
275
+
To achieve this, right click on file `main.bicep` and select **Generate Parameter File**. This will result in creating a file named `main.parameters.json` similar to the file below:
0 commit comments