During Public Preview you can use the Team plan for free, and get an early-adopter discount at GA. Sign in
Deploying a Workbook
This guide shows you how to deploy a Workbook against Locally and view it in the Locally Dashboard. As with the other guides we're going to use the Azure CLI, but the same resources can be provisioned with HashiCorp Terraform, Pulumi or Bicep too.
Before you start
- The Azure CLI (
az) installed. - Locally installed, with Locally Setup completed.
The az monitor app-insights workbook commands live in an Azure CLI extension. Locally keeps its own set of extensions, so add it through locally run:
$
locally run az extension add --name application-insights
1. Start Locally
Firstly, we need to launch Locally which we can do from a terminal by running:
$
locally build
Once Locally has started, the Locally Dashboard will open automatically:
2. Create a Resource Group
Next we can create the Resource Group:
$
locally run az group create -n sample-workbooks -l berlin
There's two things to note here:
- The Azure CLI supports Automatic Configuration, meaning that it can automatically be configured to work against Locally just by prefixing commands with
locally run. - Locally intentionally uses a different set of locations to Azure as a safety precaution, so that you can be confident you're deploying against Locally rather than regular Azure. You can also configure Locally to use the Azure locations too, but you'll want to be extra sure that you're prefixing commands with
locally runwhen you do.
3. Create something to show
A Workbook is more useful with something in it, so we'll add a Managed Identity to the Resource Group:
$
locally run az identity create -g sample-workbooks -n sample-identity --query "{name:name, type:type}"
{
"name": "sample-identity",
"type": "Microsoft.ManagedIdentity/userAssignedIdentities"
}
And a Log Analytics workspace:
$
locally run az monitor log-analytics workspace create -g sample-workbooks -n sample-workspace --query "{name:name, type:type}"
{
"name": "sample-workspace",
"type": "Microsoft.OperationalInsights/workspaces"
}
4. Write the Workbook
A Workbook is a list of steps, drawn one below the other. This one has three: a markdown note, a pie chart of the resources in the Resource Group by type, and a table of the resources themselves, both from Resource Graph queries. Save it as workbook.json:
{
"version": "Notebook/1.0",
"items": [
{
"type": 1,
"name": "intro",
"content": {
"json": "## Sample resources\nWhat's in the `sample-workbooks` Resource Group, from Resource Graph."
}
},
{
"type": 3,
"name": "by-type",
"content": {
"version": "KqlItem/1.0",
"query": "resources | where resourceGroup == 'sample-workbooks' | summarize count() by type",
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"crossComponentResources": ["value::all"],
"visualization": "piechart",
"title": "Resources by type"
}
},
{
"type": 3,
"name": "resources",
"content": {
"version": "KqlItem/1.0",
"query": "resources | where resourceGroup == 'sample-workbooks' | project name, type, location",
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"crossComponentResources": ["value::all"],
"visualization": "table",
"title": "Resources"
}
}
]
}
5. Create the Workbook
A Workbook's name has to be a GUID, and the name people see goes in its display name:
$
locally run az monitor app-insights workbook create -g sample-workbooks -n 6f1c2b8e-3d4a-4f5b-9c6d-7e8f9a0b1c2d --display-name "Sample resources" --category workbook --kind shared --serialized-data @workbook.json --query "{name:name, displayName:displayName, location:location}"
{
"displayName": "Sample resources",
"location": "berlin",
"name": "6f1c2b8e-3d4a-4f5b-9c6d-7e8f9a0b1c2d"
}
6. View it in the Locally Dashboard
Locally draws the Workbook for you, running its queries as it goes. In the Locally Dashboard, open Monitoring, then the Dashboards tab, and pick the Workbook from the list in the top-right:
The steps Locally draws are text, parameters, links and tabs, groups, metrics, and queries against Log Analytics, Application Insights, Resource Graph, ARM and JSON, shown as tables, tiles or charts. Any other step shows as a labelled placeholder in its place.
Note
7. List the Workbooks
To see the Workbooks in the Resource Group:
$
locally run az monitor app-insights workbook list -g sample-workbooks --category workbook --query "[].{Name:name, DisplayName:displayName, Location:location}" -o table
Name DisplayName Location
------------------------------------ ---------------- ----------
6f1c2b8e-3d4a-4f5b-9c6d-7e8f9a0b1c2d Sample resources berlin
Doing this with other tooling
Whilst this guide used the Azure CLI, Workbooks work the same way through any of the tooling that Locally supports - a Microsoft.Insights/workbooks resource in HashiCorp Terraform or OpenTofu, Pulumi, Bicep or an ARM Template all provision against Locally in the same way, with only the location changed.
Next steps
For a grid of tiles rather than a page of steps, see Portal Dashboards. To give a Workbook's Log Analytics queries something to find, see Diagnostic Settings.
Should you encounter any issues, please take a look at the troubleshooting section, reach out in our Discord or open an issue and we'll take a look.
Resource types this guide uses
These are the Azure resource types this guide creates in Locally:
During Public Preview you can use the Team plan for free, and get an early-adopter discount at GA. Sign in