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
Copy file name to clipboardExpand all lines: docs/aca/10-aca-iac-bicep/index.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@ You need to install an extension named [Bicep](https://marketplace.visualstudio.
39
39
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 on this [link.](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/container-apps-environment.bicep).
40
40
41
41
What we've added to this file is the following:
42
+
42
43
- The module accepts various parameters, all of them are parameters with default values, meaning that if no value is provided it will take the default value.
43
44
- The parameter `location` defaults to the container resource group location. Bicep has a function named `resourceGroup()` which you can get the location from.
44
45
- The parameters `prefix` and `suffix` could be used if you want to add a prefix or suffix to the resource names
@@ -61,23 +62,23 @@ Add a new file named `service-bus.bicep` under the folder `bicep\modules`. The c
61
62
62
63
- The output of this module will return 3 output parameters which will be used as inputs params for other modules.
63
64
64
-
#### 4. Define an Azure CosmosDb Resource
65
+
#### 5. Define an Azure CosmosDb Resource
65
66
66
67
Add a new file named `cosmos-db.bicep` under the folder `bicep\modules`. The content of the file can be found on this [link.](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/cosmos-db.bicep)
67
68
68
69
- This module will create the Azure CosmosDB account, a CosmosDB database, and a CosmosDB collection.
69
70
70
71
- The output of this module will return 3 output parameters which will be used as inputs params for other modules.
71
72
72
-
#### 5. Define an Azure Storage Resource
73
+
#### 6. Define an Azure Storage Resource
73
74
74
75
Add a new file named `storage-account.bicep` under the folder `bicep\modules`. The content of the file can be found on this [link.](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/storage-account.bicep)
75
76
76
77
- This module will create the Azure Storage account, a storage queue service, and a queue.
77
78
78
79
- The output of this module will single output parameter which is the Azure storage account name.
79
80
80
-
#### 6. Define Dapr Components
81
+
#### 7. Define Dapr Components
81
82
82
83
Next we will define all dapr components used in the solution in ne single bicep module, to accomplish this, add a new file named `dapr-components.bicep` under the folder `bicep\modules`. The content of the file can be found on this [link.](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/dapr-components.bicep)
83
84
@@ -95,20 +96,20 @@ Next we will define all dapr components used in the solution in ne single bicep
95
96
}
96
97
```
97
98
98
-
#### 7. Create Secrets into Azure Key Vault
99
+
#### 8. Create Secrets into Azure Key Vault
99
100
100
101
* This module will be responsible to create the secrets and store them in Azure Key Vault, as well it create a role assignment for the backend processor service of type`Azure Role Key Vault Secrets User` so the service can access the Key Vault and read secrets.
101
102
102
103
* To accomplish this, add a new folder named `container-apps\secrets` under the `modules` folder, and then add a new file named `processor-backend-service-secrets.bicep` under the folder `container-apps\secrets`. The content of the file can be found on this [link.](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/container-apps/secrets/processor-backend-service-secrets.bicep)
103
104
104
-
#### 8. Define the Frontend Service Azure Container App
105
+
#### 9. Define the Frontend Service Azure Container App
105
106
Now we will start defining the modules needed to create the container apps, we will start with the Frontend App, to accomplish this add a new file named `webapp-frontend-service.bicep` under the folder `modules\container-apps`. The content of the file can be found on this [link.](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/container-apps/webapp-frontend-service.bicep)
106
107
107
108
- Notice how we used the attribute `@secure` on input parameters which contain secrets or keys, this attribute can be applied on string and object parameters that contain secret values, when it is used Azure won't make the parameter values available in the deployment logs nor on the terminal if you are using Azure CLI.
108
109
109
110
- The out parameters this module will return the fully qualified domain name (FQDN) of the frontend container app.
110
111
111
-
#### 9. Define the Backend Api Service Azure Container App
112
+
#### 10. Define the Backend Api Service Azure Container App
112
113
113
114
Add a new file named `webapi-backend-service.bicep` under the folder `modules\container-apps`. The content of the file can be found on this [link.](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/container-apps/webapi-backend-service.bicep)
114
115
@@ -138,7 +139,7 @@ Add a new file named `webapi-backend-service.bicep` under the folder `modules\co
138
139
}
139
140
```
140
141
141
-
#### 10. Define the Backend Processor Service Azure Container App
142
+
#### 11. Define the Backend Processor Service Azure Container App
142
143
Add a new file named `processor-backend-service.bicep` under the folder `modules\container-apps`. The content of the file can be found on this [link.](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/container-apps/processor-backend-service.bicep)
143
144
144
145
- 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, this done using the code below:
@@ -170,10 +171,10 @@ Add a new file named `processor-backend-service.bicep` under the folder `modules
170
171
}
171
172
```
172
173
173
-
#### 11. Define a container module for the 3 Container Apps
174
+
#### 12. Define a container module for the 3 Container Apps
174
175
This module will act as a container forthe 3 Container Apps modules definedin the previous 3 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 on this [link.](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/modules/container-apps.bicep)
175
176
176
-
#### 12. Define the Main module for the solution
177
+
#### 13. Define the Main module for the solution
177
178
Lastly, we need to define the Main Bicep module which will link all other modules together, this will be the file that is referenced from AZ CLI command when creating the entire resources, to do so add a new file named `main.bicep` under the folder `bicep`, the content of the file can be found on this [link.](https://github.com/Azure/aca-dotnet-workshop/blob/main/bicep/main.bicep)
0 commit comments