During Public Preview you can use the Team plan for free, and get an early-adopter discount at GA. Sign in
Deploying an Azure Monitor Workspace
This guide shows you how to deploy 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.
Before you start
- The Azure CLI (
az) installed. - Locally installed, with Locally Setup completed.
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-resources -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 the Workspace
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. 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:
Doing this with other tooling
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.
Next steps
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, 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