Sign in during Public Preview to get the Team plan free, plus an early-adopter discount when we launch. Sign in
This guide shows you how to provision an Azure Monitor workspace against Locally - the workspace that stores Prometheus metrics. 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.
This covers the control plane only. Locally doesn't emulate the workspace's data plane yet, so you can create and manage the workspace, but not send metrics to it or query them.
az) installed.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:
Next we can create the Resource Group:
$
locally run az group create -n sample-resources -l berlin
There's two things to note here:
locally run.locally run when you do.With the Resource Group in place, we can create the workspace. The Azure CLI calls these accounts, after the Microsoft.Monitor/accounts resource type:
$
locally run az monitor account create -n sample-amw -g sample-resources -l berlin
{
"note": "some fields skipped for brevity",
"id": "/subscriptions/307d8f52-9719-460e-9f85-aa408e28ee55/resourceGroups/sample-resources/providers/Microsoft.Monitor/accounts/sample-amw",
"metrics": {
"prometheusQueryEndpoint": "https://sample-amw.monitor.locally:5668/"
},
"name": "sample-amw",
"provisioningState": "Succeeded",
"type": "Microsoft.Monitor/accounts"
}
The response includes a prometheusQueryEndpoint, as it does in Azure. We can read it back at any point:
$
locally run az monitor account show -n sample-amw -g sample-resources --query metrics.prometheusQueryEndpoint -o tsv
Note
defaultIngestionSettings, which Azure creates in a managed Resource Group - Locally returns their IDs, but doesn't create them.We can list the workspaces in the Resource Group:
$
locally run az monitor account list -g sample-resources --query "[].{Name:name, Location:location, State:provisioningState}" -o table
Name Location State
---------- ---------- ---------
sample-amw berlin Succeeded
And update one, here to add a tag:
$
locally run az monitor account update -n sample-amw -g sample-resources --tags env=dev --query "{name:name, tags:tags}"
{
"name": "sample-amw",
"tags": {
"env": "dev"
}
}
We can see the Azure Monitor workspace in the Locally Dashboard too:
Whilst this guide used the Azure CLI, an Azure Monitor workspace works the same way through any of the tooling that Locally supports - a Microsoft.Monitor/accounts 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.
To alert on activity in your subscription, see Alerts. To provision the rest of your monitoring alongside the workspace, see Log Analytics Workspace and Application Insights.
Should you encounter any issues, please take a look at the troubleshooting section.
Sign in during Public Preview to get the Team plan free, plus an early-adopter discount when we launch. Sign in
Your Azure infrastructure, running on your machine. Deploy in seconds, break things freely, and ship to Azure when you're ready.