- Published on
Bicep Deployments
- Authors
- Name
- Me
Introduction
As a way to dwelve more into Azure and DevOps practises, I looked into deployment using the Bicep language. Throughout this project I deployed several services such as CosmoDB, AKS, Load Balancers and more. Below I share the project files, and describe some files in more detail.
Description
Github link (ask for access): https://github.com/valkehh/bicep
aca.bicep
Deployment of a Azure Container App alongside a virtual network. Looks for a bicepparam file to set things such as app name and image credentials. Hardcoded to create a 0.5 cpu instance with 1GB of ram. Fetches the resource group id from the resource.bicep file.
aci.bicep
Azure Container Instance deployment together with IP setup. The associated bicepparam file sets up the name of the app and image information. Cpu and Memory options are hardcoded to be 1 and 2 respectively.
aks.bicep
Azure Kubernetes Service deployment together with SSH access. The bicepparam file sets variables like VMsize, skuTier and name, clusterName etc. This gets set up as a managed cluster configured to allow ssh access depending on supplied public key.
free.bicep (cosmodb)
Deploys the "free" tier of cosmoDB. Pulls relevant information from bicepparam file, like server location, database and container names, etc.
order.txt
Below is the standard procedure of setting up an ACA instance, and building/pushing an image to ACR. First the resource group gets created, then the container registry, and lastly the ACA. The ACA instance is configured to pull the image from ACR whenever an update has been done.
1. Resource
az deployment sub create --name albinDeployment --location swedencentral --template-file resource.bicep --parameters resource.bicepparam
2. Registry
az deployment group create --resource-group albinRG --confirm-with-what-if --template-file registry.bicep
2.1
# Login to register
az acr login --name acrnojmcwg5sjoxo.azurecr.io
# Build webapp to image and push
docker buildx build --platform linux/amd64 . -t acrnojmcwg5sjoxo.azurecr.io/kanslobarometern:latest --push
3. Aca
az deployment group create --resource-group albinRG --confirm-with-what-if --template-file aca.bicep --parameters aca.bicepparam