Query Prometheus metrics using Azure workbooks

Create dashboards powered by Azure Monitor managed service for Prometheus using Azure Workbooks. This article introduces workbooks for Azure Monitor workspaces and shows you how to query Prometheus metrics using Azure workbooks and the Prometheus query language (PromQL).


To query Prometheus metrics from an Azure Monitor workspace you need the following:

  • An Azure Monitor workspace. To create an Azure Monitor workspace see Create an Azure Monitor Workspace.
  • Your Azure Monitor workspace must be collecting Prometheus metrics from an AKS cluster.
  • The user must be assigned role that can perform the microsoft.monitor/accounts/read operation on the Azure Monitor workspace.

Prometheus Explorer workbook

Azure Monitor workspaces include an exploration workbook to query your Prometheus metrics.

  1. From the Azure Monitor workspace overview page, select Prometheus explorer

Screenshot that shows Azure Monitor workspace menu selection.

  1. Or the Workbooks menu item, and in the Azure Monitor workspace gallery, select the Prometheus Explorer workbook tile.

Screenshot that shows Azure Monitor workspace gallery.

A workbook has the following input options:

  • Time Range. Select the period of time that you want to include in your query. Select Custom to set a start and end time.
  • PromQL. Enter the PromQL query to retrieve your data. For more information about PromQL, see Querying Prometheus.
  • Graph, Grid, and Dimensions tabs. Switch between a graphic, tabular, and dimensional view of the query output.

Screenshot that shows PromQL explorer.

Create a Prometheus workbook

Workbooks supports many visualizations and Azure integrations. For more information about Azure Workbooks, see Creating an Azure Workbook.

  1. From your Azure Monitor workspace select Workbooks.

  2. Select New.

  3. In the new workbook, select Add, and select Add query from the dropdown. A screenshot showing the add content dropdown in a blank workspace.

  4. Azure Workbooks use data sources to set the source scope the data they present. To query Prometheus metrics, select the Data source dropdown, and choose Prometheus .

  5. From the Azure Monitor workspace dropdown, select your workspace.

  6. Select your query type from Prometheus query type dropdown.

  7. Write your PromQL query in the Prometheus Query field.

  8. Select Run Query button.

  9. Select the Done Editing at the bottom of the section and save your work

Screenshot that shows sample PromQL query.


If your workbook query does not return data:

  • Check that you have sufficient permissions to perform microsoft.monitor/accounts/read assigned through Access Control (IAM) in your Azure Monitor workspace
  • Verify that you have turned on metrics collection in the Monitored clusters blade of your Azure Monitor workspace.

Next steps