|
| 1 | +--- |
| 2 | +title: Add an Azure Monitor workspace to Azure Managed Grafana |
| 3 | +description: Learn how to add an Azure Monitor workspace to Azure Managed Grafana to collect Prometheus data. |
| 4 | +ms.service: managed-grafana |
| 5 | +ms.topic: how-to |
| 6 | +author: maud-lv |
| 7 | +ms.author: malev |
| 8 | +ms.date: 11/10/2023 |
| 9 | +--- |
| 10 | + |
| 11 | +# Add an Azure Monitor workspace to Azure Managed Grafana to collect Prometheus data |
| 12 | + |
| 13 | +In this guide, learn how to connect an Azure Monitor workspace to Grafana directly from an Azure Managed Grafana workspace. This feature is designed to provide a quick way to collect Prometheus metrics stored in an Azure Monitor workspace and enables you to monitor your Azure Kubernetes Service (AKS) clusters in Grafana. |
| 14 | + |
| 15 | +> [!IMPORTANT] |
| 16 | +> The integration of Azure Monitor workspaces within Azure Managed Grafana workspaces is currently in PREVIEW. |
| 17 | +> See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability. |
| 18 | + |
| 19 | +## Prerequisites |
| 20 | + |
| 21 | +- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free). |
| 22 | +- An Azure Managed Grafana instance in the Standard tier. [Create a new instance](quickstart-managed-grafana-portal.md) if you don't have one. |
| 23 | +- An [Azure Monitor workspace with Prometheus data](../azure-monitor/containers/prometheus-metrics-enable.md). |
| 24 | + |
| 25 | +## Add a new role assignment |
| 26 | + |
| 27 | +In the Azure Monitor workspace, assign the *Monitoring Data Reader* role to the Azure Managed Grafana resource's managed identity, so that Grafana can collect data from the Azure Monitor workspace. |
| 28 | + |
| 29 | +> [!NOTE] |
| 30 | +> A system-assigned managed identity must be enabled in your Azure Managed Grafana resource. If needed, enable it by going to **Identity** and select **Status**: **On**. |
| 31 | + |
| 32 | +To assign the Monitoring Data Reader role: |
| 33 | + |
| 34 | +1. Open the Azure Monitor workspace that holds Prometheus data. |
| 35 | +1. Go to **Access control (IAM)** > **Add** > **Add role assignment**. |
| 36 | +1. Select the **Monitoring Data Reader** role, then **Next**. |
| 37 | +1. For **Assign access to**, select **Managed identity** |
| 38 | +1. Open **Select members** and select your Azure Managed Grafana resource. |
| 39 | +1. Select **Review + assign** to initiate the role assignment |
| 40 | + |
| 41 | +## Add an Azure Monitor workspace |
| 42 | + |
| 43 | +1. Open your Azure Managed Grafana workspace. |
| 44 | +1. In the left menu, select **Integrations** > **Azure Monitor workspaces (Preview**). |
| 45 | + |
| 46 | + :::image type="content" source="media\monitor-integration\add-azure-monitor.png" alt-text="Screenshot of the Grafana roles in the Azure platform."::: |
| 47 | + |
| 48 | +1. Select **Add**. |
| 49 | +1. In the pane that opens, select an Azure Monitor workspace from the list and confirm with **Add**. |
| 50 | +1. Once the operation is complete, Azure displays all the Azure Monitor workspaces added to the Azure Managed Grafana workspace. You can add more Azure Monitor workspaces by selecting **Add** again. |
| 51 | + |
| 52 | +## Display Prometheus data in Grafana |
| 53 | + |
| 54 | +When you added the Azure Monitor workspace to Azure Managed Grafana in the previous step, Azure added a new Prometheus data source to Grafana. |
| 55 | + |
| 56 | +To get a dashboard with Prometheus metrics, either use one of the prebuilt dashboards or build a brand new one. |
| 57 | + |
| 58 | +### Use a prebuilt dashboard |
| 59 | + |
| 60 | +In Grafana, go to **Dashboards** from the left menu and expand the **Managed Prometheus** data source. Review the list of prebuilt dashboards and open one that seems interesting to you. |
| 61 | + |
| 62 | +The following automatically generated dashboards are available, as of November 7, 2023: |
| 63 | + |
| 64 | +- Kubernetes / Compute Resources / Cluster |
| 65 | +- Kubernetes / Compute Resources / Cluster (Windows) |
| 66 | +- Kubernetes / Compute Resources / Namespace (Pods) |
| 67 | +- Kubernetes / Compute Resources / Namespace (Windows) |
| 68 | +- Kubernetes / Compute Resources / Namespace (Workloads) |
| 69 | +- Kubernetes / Compute Resources / Node (Pods) |
| 70 | +- Kubernetes / Compute Resources / Pod |
| 71 | +- Kubernetes / Compute Resources / Pod (Windows) |
| 72 | +- Kubernetes / Compute Resources / Workload |
| 73 | +- Kubernetes / Kubelet |
| 74 | +- Kubernetes / Networking |
| 75 | +- Kubernetes / USE Method / Cluster (Windows) |
| 76 | +- Kubernetes / USE Method / Node (Windows) |
| 77 | +- Node Exporter / Nodes |
| 78 | +- Node Exporter / USE Method / Node |
| 79 | +- Overview |
| 80 | + |
| 81 | +The following screenshot shows some of the panels from the "Kubernetes / Compute Resources / Cluster" dashboard. |
| 82 | + |
| 83 | +:::image type="content" source="media\monitor-integration\prometheus-prebuilt-dashboard.png" alt-text="Screenshot of prebuilt dashboard showing Prometheus metrics."::: |
| 84 | + |
| 85 | +Edit the dashboard as desired. For more information about editing a dashboard, read [Edit a dashboard panel](./how-to-create-dashboard.md#edit-a-dashboard-panel). |
| 86 | + |
| 87 | +### Create a new dashboard |
| 88 | + |
| 89 | +To build a brand new dashboard with Prometheus metrics: |
| 90 | + |
| 91 | +1. Open Grafana and select **Connections** > **Your connections** from the left menu. |
| 92 | +1. Find the new Prometheus data source. |
| 93 | + |
| 94 | + :::image type="content" source="media\monitor-integration\prometheus-data-source.png" alt-text="Screenshot of a new Prometheus data source displayed in the Grafana user interface."::: |
| 95 | + |
| 96 | +1. Select **Build a dashboard** to start creating a new dashboard with Prometheus metrics. |
| 97 | +1. Select **Add visualization** to start creating a new panel. |
| 98 | +1. Under **metrics**, select a metric and then **Run queries** to check that your dashboard can collect and display your Prometheus data. |
| 99 | + |
| 100 | + :::image type="content" source="media\monitor-integration\new-dashboard.png" alt-text="Screenshot the Grafana UI, showing a new dashboard displaying Prometheus data."::: |
| 101 | + |
| 102 | + For more information about editing a dashboard, read [Edit a dashboard panel](./how-to-create-dashboard.md#edit-a-dashboard-panel). |
| 103 | + |
| 104 | +> [!TIP] |
| 105 | +> If you're unable to get Prometheus data in your dashboard, check if your Azure Monitor workspace is collecting Prometheus data. Go to [Troubleshoot collection of Prometheus metrics in Azure Monitor](../azure-monitor/containers/prometheus-metrics-troubleshoot.md) for more information. |
| 106 | + |
| 107 | +## Remove an Azure Monitor workspace |
| 108 | + |
| 109 | +If you no longer need it, you can remove an Azure Monitor workspace from your Azure Managed Grafana workspace: |
| 110 | + |
| 111 | +1. In your Azure Managed Grafana workspace, select **Integrations** > **Azure Monitor workspaces (Preview**) from the left menu. |
| 112 | +1. Select the row with the resource to delete and select **Delete** > **Yes**. |
| 113 | + |
| 114 | +Optionally also remove the role assignment that was previously added in the Azure Monitor workspace: |
| 115 | + |
| 116 | +1. In the Azure Monitor workspace resource, select **Access control (IAM)** > **Role assignments**. |
| 117 | +1. Under **Monitoring Data Reader**, select the row with the name of your Azure Managed Grafana resource and select **Remove** > **OK**. |
| 118 | + |
| 119 | +To learn more about Azure Monitor managed service for Prometheus, read the [Azure Monitor managed service for Prometheus guide](../azure-monitor/essentials/prometheus-metrics-overview.md). |
| 120 | + |
| 121 | +## Next steps |
| 122 | + |
| 123 | +In this how-to guide, you learned how to connect an Azure Monitor workspace to Grafana. To learn how to create and configure Grafana dashboards, go to [Create dashboards](how-to-create-dashboard.md). |
0 commit comments