Azure Monitor Workbooks provide rich, interactive dashboards for operational data — but creating them manually through the portal means they live outside your deployment pipeline. By defining workbooks as Bicep resources you can version-control, peer-review, and consistently deploy monitoring dashboards alongside the infrastructure they observe.
Prerequisites
You will need the Azure CLI and Bicep CLI version 0.22 or later, plus a Log Analytics workspace to target.
az bicep upgrade
az bicep version Workbook Bicep Resource
Workbooks are stored as microsoft.insights/workbooks resources. The serializedData property holds the workbook JSON definition.
resource workbook 'microsoft.insights/workbooks@2022-04-01' = {
name: guid(resourceGroup().id, 'ops-dashboard')
location: location
kind: 'shared'
properties: {
displayName: 'Operations Dashboard'
serializedData: loadTextContent('workbooks/ops-dashboard.json')
sourceId: logAnalyticsWorkspaceId
category: 'workbook'
}
} Exporting an Existing Workbook
Design your workbook in the Azure Portal first, then export it via Advanced Editor to get the JSON you store in source control.
# Retrieve workbook JSON via Azure CLI and save to repo
az monitor workbook show --resource-group rg-monitoring --name my-workbook `
--query 'properties.serializedData' -o tsv `
| Out-File "workbooks/ops-dashboard.json" Deploying via GitHub Actions
Trigger a workbook deployment whenever the JSON definition changes in your repository.
name: Deploy Workbooks
on:
push:
paths: ['workbooks/**', 'infra/workbooks.bicep']
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- run: az deployment group create --resource-group rg-monitoring --template-file infra/workbooks.bicep Summary
Storing Azure Monitor Workbooks as Bicep resources brings your monitoring configuration into the same lifecycle as your infrastructure. Teams can propose workbook changes through pull requests, ensuring dashboards are reviewed, tested, and consistently deployed across all environments.