Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Cloud deployments have come a long way. Instead of clicking through the Azure Portal every time you need a resource, you can now describe your entire infrastructure in code and let automation do the heavy lifting. This is the essence of Infrastructure as Code (IaC)—and with tools like Bicep, Azure DevOps Pipelines, and GitHub Actions, you can go from manual deployments to fully automated pipelines.
In this blog, we’ll take a deep dive into:
By the end, you’ll have all the knowledge needed to go from beginner IaC deployments to professional-grade CI/CD automation.
Bicep is a Domain Specific Language (DSL) for deploying Azure resources. It’s built on top of ARM (Azure Resource Manager) templates but is far more developer-friendly.
Think of Bicep as ARM’s smarter, friendlier sibling.
Let’s start small: deploying an App Service Plan and a Web App.
param appName string = 'my-bicep-webapp'
param location string = resourceGroup().location
param sku string = 'F1'
resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = {
name: '${appName}-plan'
location: location
sku: {
name: sku
tier: 'Free'
}
}
resource webApp 'Microsoft.Web/sites@2022-09-01' = {
name: appName
location: location
properties: {
serverFarmId: appServicePlan.id
}
}
Once you save the file as main.bicep, you can deploy it using the Azure CLI:
az group create --name MyResourceGroup --location eastus
az deployment group create \
--resource-group MyResourceGroup \
--template-file main.bicep
oom 💥—your App Service Plan and Web App are live!
But running these commands manually isn’t automation. Let’s take it a step further.
Your main.bicep file should live in Azure Repos or GitHub. This gives you version control and team collaboration.
Here’s a sample pipeline:
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: AzureCLI@2
inputs:
azureSubscription: '<your-service-connection>'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az group create --name MyResourceGroup --location eastus
az deployment group create \
--resource-group MyResourceGroup \
--template-file main.bicep
If you prefer GitHub, the flow is similar.
Inside your repo, create .github/workflows/deploy.yml:
name: Deploy Azure Resources
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy Bicep template
run: |
az group create --name MyResourceGroup --location eastus
az deployment group create \
--resource-group MyResourceGroup \
--template-file main.bicep
In GitHub:
AZURE_CREDENTIALS (from a service principal JSON).main.bicep to your repo.main.bicep to your GitHub repo.az ad sp create-for-rbac → copy JSON → add as AZURE_CREDENTIALS secret in GitHub..github/workflows.With Bicep you define your Azure infrastructure in clean, readable code. With Azure DevOps or GitHub Actions, you automate the entire lifecycle—from commit to deployment.
This is the power of Infrastructure as Code + CI/CD:
🚀 Next step: Take your Bicep template, drop it into a pipeline, and enjoy push-to-deploy infrastructure.