Chendrayan Venkatesan


Chendrayan Venkatesan

3-Minute Read



In my previous blog post, we got basic information about the Azure Container Apps! As we all know, the Azure Container Apps service is in preview, and there is a lot more to add to the features list. Now, let us see how to build a Bicep template to deploy an application in container apps. First, I would like to thank Thorsten Hans for the fantastic blog post How to deploy Azure Container Apps with Bicep.

While following the steps shared by Thorsten Hans, I see an issue in the listKeys() function. So, I slightly modified the code as illustrated below, and it is modularized for easy readability.


Bicep Template


param environment string = 'dev'
param owner string = 'Chendrayan Venkatesan'
param costcenter string = 'AZ-0023'
param suffix string = 'dev'
param location string = 'northeurope'
param logAnalyticsName string = 'Law-Containers-App'
param kubeEnvironmentName string = 'Kube-Environment'
param containerAppName string = 'colorsofcuisine'
param registryPassword string = 'REPLACEWITHYOURPASSWORD'

Resource Group

resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
  name: 'colorsofcuisine-${suffix}'
  location: location
  tags: {
    'env': environment
    'owner': owner
    'costcenter': costcenter

Create a Log Analytics Workspace

Module Code

module LogAnalyticsworkSpace 'modules/az-log-analytics/log-analytics.bicep' = {
  name: 'log-analytics-deployment'
  scope: resourceGroup(rg.name)
  params: {
    logAnalyticsName: '${logAnalyticsName}-${suffix}'

Create a Kube Environment

Module Code

module kubeEnvironment 'modules/az-kube-environment/az-kube-environment.bicep' = {
  name: 'kube-deployment-${suffix}'
  params: {
    customerId: LogAnalyticsworkSpace.outputs.customerId
    primarySharedKey: LogAnalyticsworkSpace.outputs.primarySharedKey
    kubeEnvironmentName: '${kubeEnvironmentName}-${suffix}'
  scope: resourceGroup(rg.name)

Create Azure Container App

Module Code

module containerApp 'modules/az-container-app/container-app.bicep' = {
  name: '${containerAppName}-${suffix}'
  scope: resourceGroup(rg.name)
  params: {
    kubeEnvironmentId: kubeEnvironment.outputs.kubeEnvironmentId
    registryPassword: registryPassword
    containerAppName: containerAppName

Docker Image

FROM mcr.microsoft.com/powershell:latest
WORKDIR /usr/src/app/
COPY . .    
RUN pwsh -c "Install-Module 'Pode' , 'PSHTML' -Force -AllowClobber"
CMD [ "pwsh", "-c", "cd /usr/src/app; ./app.ps1" ]

Docker Image is available here and you can develop and replace app.ps1

┣ 📂application
┃ ┣ 📂views
┃ ┃ ┗ 📜index.ps1
┃ ┣ 📜app.ps1
┃ ┗ 📜Dockerfile
┗ 📜readme.md

Application (app.ps1)

Start-PodeServer {
    Add-PodeEndpoint -Address * -Port 80 -Protocol Http
    Set-PodeViewEngine -Type PSHTML -Extension PS1 -ScriptBlock {
        param($path, $data)
        return (. $path $data)
    Add-PodeRoute -Method Get -Path '/' -ScriptBlock {
        Write-PodeViewResponse -Path "index.ps1"

Views (views/index.ps1)


function CustomCard {
    Param (

    Div -Class 'cell-lg-4' -Content {
        Div -Class 'price-item text-center bg-white win-shadow' -Content {
            Div -Class 'price-item-header p-6' -Content {
                Div -Class 'img-container rounded' -Content {
                    img -src $($ImageSrc)
                    Div -Class 'image-overlay op-green' 
return html -Content {
    head -Content {
        Title -Content "CoC | Index"
        Link -href "https://cdn.metroui.org.ua/v4.3.2/css/metro-all.min.css" -rel "stylesheet"
        script -src "https://cdn.metroui.org.ua/v4/js/metro.min.js"
    body -Content {
        (1..3).ForEach({ br })
        Div -Class 'container' -Content {
            h3 -Class 'Secondary fg-lightBlue' -Content 'Colors of Cuisine...' -Style 'text-align:center'
            Div -Class 'row flex-align-center rounded' -Content {
                        CustomCard -ImageSrc $($_)  

Get On Action


Congratulations on running your Azure Container Apps using PowerShell, Pode and PSHML. There are a lot more coming up in the future, and please feel free to subscribe to my YouTube channel - iAutomate and follow me on Twitter ChendrayanV

Say Something


Nothing yet.

Recent Posts



Dedicated IT professional with a history of meeting company goals utilizing consistent and organized practices, skilled in working under pressure....