Skip to content
Get Started for Free

Workbook

Azure Monitor Workbooks are interactive reports that combine text, KQL queries, metrics, and visualizations into a single shareable document. Workbook templates are Azure Resource Manager resources that package reusable definitions and gallery metadata so teams can publish templates to experiences such as Azure Monitor workbooks galleries. They are commonly used to create operational dashboards, cost reports, and compliance summaries that surface data from multiple Azure Monitor sources. For more information, see Azure Workbooks overview.

LocalStack for Azure provides a local environment for building and testing applications that make use of Azure Monitor Workbooks. The supported APIs are available on our API Coverage section, which provides information on the extent of Workbooks’ integration with LocalStack.

This guide walks you through creating a workbook and a workbook template.

Launch LocalStack using your preferred method. For more information, see Introduction to LocalStack for Azure. Once the container is running, enable Azure CLI interception by running:

Terminal window
azlocal start-interception

This command points the az CLI away from the public Azure management REST API and toward the LocalStack for Azure emulator API. To revert this configuration, run:

Terminal window
azlocal stop-interception

This reconfigures the az CLI to send commands to the official Azure management REST API.

Create a resource group to hold all resources created in this guide:

Terminal window
az group create --name rg-workbook-demo --location westeurope
Output
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-workbook-demo",
"location": "westeurope",
"name": "rg-workbook-demo",
"properties": { "provisioningState": "Succeeded" },
"type": "Microsoft.Resources/resourceGroups"
}

Generate a UUID for the workbook name, then create a shared workbook:

Terminal window
WORKBOOK_ID=$(python3 -c "import uuid; print(uuid.uuid4())")
az monitor app-insights workbook create \
--name "$WORKBOOK_ID" \
--resource-group rg-workbook-demo \
--display-name "My Workbook" \
--kind shared \
--category workbook \
--version "Notebook/1.0" \
--serialized-data '{"version":"Notebook/1.0","items":[{"type":1,"content":{"json":"## My Workbook\nHello, world!"},"name":"text-0"}],"isLocked":false}' \
--location westeurope
Output
{
"category": "workbook",
"displayName": "My Workbook",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-workbook-demo/providers/Microsoft.Insights/workbooks/de747180-ecea-4b97-bef4-f8376fc72abe",
"kind": "shared",
"location": "westeurope",
"name": "de747180-ecea-4b97-bef4-f8376fc72abe",
"serializedData": "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":{\"json\":\"## My Workbook\\nHello, world!\"},\"name\":\"text-0\"}],\"isLocked\":false}",
"type": "Microsoft.Insights/workbooks",
"version": "Notebook/1.0"
}

List all workbooks in the resource group filtered by category:

Terminal window
az monitor app-insights workbook list \
--resource-group rg-workbook-demo \
--category workbook
Output
[
{
"category": "workbook",
"displayName": "My Workbook",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-workbook-demo/providers/Microsoft.Insights/workbooks/de747180-ecea-4b97-bef4-f8376fc72abe",
"kind": "shared",
"location": "westeurope",
"name": "de747180-ecea-4b97-bef4-f8376fc72abe",
"serializedData": "...",
"type": "Microsoft.Insights/workbooks",
"version": "Notebook/1.0"
}
]

Workbook templates are not exposed as a first-party az monitor app-insights command group. Use az rest against the resource manager endpoint (via your active cloud, which LocalStack updates when interception is enabled):

Terminal window
RM=$(az cloud show --query "endpoints.resourceManager" -o tsv | sed 's|/$||')
az rest --method PUT \
--url "${RM}/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-workbook-demo/providers/microsoft.insights/workbookTemplates/my-template?api-version=2020-11-20" \
--body '{
"location": "westeurope",
"properties": {
"priority": 1,
"author": "My Team",
"templateData": {
"version": "Notebook/1.0",
"items": []
},
"galleries": [
{
"name": "My Template",
"category": "General",
"type": "workbook",
"order": 100,
"resourceType": "Azure Monitor"
}
]
}
}'
Output
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-workbook-demo/providers/Microsoft.Insights/workbookTemplates/my-template",
"location": "westeurope",
"name": "my-template",
"properties": {
"author": "My Team",
"galleries": [
{
"category": "General",
"name": "My Template",
"order": 100,
"resourceType": "Azure Monitor",
"type": "workbook"
}
],
"priority": 1,
"templateData": {
"version": "Notebook/1.0",
"items": []
}
},
"type": "Microsoft.Insights/workbookTemplates"
}

Delete the workbook and workbook template, then delete the resource group. Use the same shell session as earlier steps so WORKBOOK_ID and RM are still set.

Terminal window
az monitor app-insights workbook delete \
--name "$WORKBOOK_ID" \
--resource-group rg-workbook-demo \
--yes
az rest --method DELETE \
--url "${RM}/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-workbook-demo/providers/microsoft.insights/workbookTemplates/my-template?api-version=2020-11-20"
az group delete --name rg-workbook-demo --yes
  • Workbook lifecycle: Create, read, list, update, and delete workbooks.
  • Workbook template lifecycle: Create, read, list, update, and delete workbook templates.
  • Shared and private workbooks: The Workbooks REST API defines kind values shared and user. The Azure CLI workbook create command currently exposes only --kind shared (see az monitor app-insights workbook create).
  • Category filtering: For list by resource group, the category query parameter is one of workbook, TSG, performance, or retention (the same set the CLI accepts on workbook list --category). The properties.category value stored on a workbook resource is a separate string that you set at creation time.
  • Serialized data storage: Store the full workbook JSON definition in the serializedData field.
  • Gallery configuration: Define workbook templates with gallery metadata for easy discovery.
  • No rendering or query execution: The workbook content is stored as a JSON string but KQL queries within the workbook are not executed.
  • No Azure Portal integration: Workbooks cannot be previewed or rendered via LocalStack.
  • No linked resource validation: Source ID references to Application Insights components or subscriptions are accepted but not validated.

Explore end-to-end examples in the LocalStack for Azure Samples repository.

OperationImplemented
Page 1 of 0
Was this page helpful?