Skip to content

Commit 3933a19

Browse files
author
Wael Kdouh
committed
Carried additional refactoring on the bicep module
1 parent 2fbc878 commit 3933a19

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

docs/aca/10-aca-iac-bicep/index.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ canonical_url: https://bitoftech.net/2022/09/16/use-bicep-to-deploy-dapr-microse
33
---
44

55
# Module 10 - Deployment Via Bicep
6+
!!! info "Module Duration"
7+
30 minutes
8+
69
Throughout the various modules, we have utilized various Azure CLI commands to provision different resources. While this approach is suitable for this workshop, in a production environment, you will likely require a more automated process to deploy the same resources. In this module, we will be working on defining the proper process to automate the infrastructure provisioning by creating the scripts/templates to provision the resources. This process is known as IaC (Infrastructure as Code).
710

811
Once we have this in place, IaC deployments will benefit us in key ways such as:
@@ -30,7 +33,7 @@ To begin, we need to define the Bicep modules that will be required to generate
3033
![aca-resources](../../assets/images/10-aca-iac-bicep/aca-rescources.jpg)
3134

3235
!!! note
33-
To simplify the execution of the module, we will assume that the azure resource "Azure Container Registry" is already provisioned and it contains the latest images of the three services. If we deployed ACR part of the Bicep scripts, then we can't build and push images to the created ACR in an automated way because creating the three ACA container apps is reliant on ACR's images. [This section](../../aca/08-aca-monitoring/index.md#2-build-new-images-and-push-them-to-acr) shows the different commands to build and push the images to an existing ACR. Make sure you are at the root project directory when executing the aforementioned commands.
36+
To simplify the execution of the module, we will assume that the azure resource "Azure Container Registry" is already provisioned and it contains the latest images of the three services. If we deployed ACR part of the Bicep scripts, then we can't build and push images to the created ACR in an automated way because creating the three ACA container apps is reliant on ACR's images.
3437

3538
In a production setting, a DevOps pipeline would be in place to automate the whole process - commencing with ACR creation, followed by building and pushing docker images, and concluding with executing the Bicep script to establish the remaining resources. As it is outside the scope of this workshop, we will not delve into the creation of a DevOps pipeline here.
3639
#### 1. Add the Needed Extension to VS Code
@@ -186,21 +189,35 @@ With the steps above completed we are ready to deploy all the different resource
186189

187190
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.
188191

189-
Start the deployment by calling `az deployment group create`. To accomplish this, open the PowerShell console and use the content below. We will assume you have an existing resource group named `aca-workshop-bicep-rg` along with an ACR deployment which includes the docker images to be deployed to your different Azure Container Apps.
192+
Start the deployment by calling `az deployment group create`. To accomplish this, open the PowerShell console and use the content below.
190193

191194
```Powershell
192195
az group create `
193-
--name "aca-workshop-bicep-rg" `
196+
--name "<your RG name>" `
194197
--location "eastus"
198+
```
199+
200+
Next create an ACR inside the newly created Resource Group:
201+
202+
```Powershell
203+
az acr create `
204+
--resource-group <your RG name> `
205+
--name <your ACR name>`
206+
--sku Basic `
207+
--admin-enabled true
208+
```
195209

210+
!!! note
211+
Once the RG and ACR are created you can check [this section](../../aca/08-aca-monitoring/index.md#2-build-new-images-and-push-them-to-acr) which shows the different commands to build and push the images to ACR. Make sure you are at the root project directory when executing the aforementioned commands. Finally run the bicep file against the newly created Resource Group as shown below.
196212

213+
```Powershell
197214
az deployment group create `
198-
--resource-group "aca-workshop-bicep-rg" `
215+
--resource-group "<your RG name>" `
199216
--template-file "./bicep/main.bicep" `
200217
--parameters "./bicep/main.parameters.json"
201218
```
202219

203-
The Azure CLI will take the Bicep module and start creating the deployment in the resource group `aca-workshop-bicep-rg`.
220+
The Azure CLI will take the Bicep module and start creating the deployment in the resource group.
204221

205222
### Verify the Final Results
206223
!!! success

0 commit comments

Comments
 (0)