---
title: "Configure serverless Azure metrics with Cloud Provider | Grafana Cloud documentation"
description: "How to configure serverless Azure metrics with Cloud Provider"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Configure serverless Azure Metrics with Cloud Provider

Use the Grafana Cloud Provider UI to connect your Azure account and begin collecting metrics without deploying any collector or agent on your own infrastructure. When you create a credential, Cloud Provider uses your Azure service principal to discover your subscriptions and resources and begins collecting metrics automatically every two minutes.

To configure serverless Azure metrics using Terraform instead, refer to [Configure serverless Azure metrics with Terraform](../config-azure-metrics-serverless/).

## Before you begin

- You have a [Grafana Cloud account](/auth/sign-up/create-user).
- You have either the Admin [Grafana Cloud basic role](/docs/grafana/latest/administration/roles-and-permissions/access-control/#basic-roles) or the [Azure Writer plugin role](/docs/grafana-cloud/monitor-infrastructure/monitor-cloud-provider/rbac/#cloud-provider-app-plugin-roles) for your stack. For steps to assign RBAC roles, refer to [Assign RBAC roles](/docs/grafana/latest/administration/roles-and-permissions/access-control/assign-rbac-roles/).
- You have an Azure account with at least one subscription you want to monitor.
- You have the **Client ID**, **Client secret**, and **Tenant ID** for an Azure service principal with the `Monitoring Reader` role assigned. If you need to create one, follow the steps in [Configure Azure authorization](/docs/grafana-cloud/monitor-infrastructure/monitor-cloud-provider/azure/collect-azure-serverless/config-azure-metrics-serverless/#configure-azure-authorization).

## Navigate to Azure serverless

The first step in setting up serverless Azure metrics in Cloud Provider is getting to the page where you can enter your Azure credentials.

To navigate to Azure serverless in Grafana Cloud:

1. Navigate to your [Grafana Cloud Portal](/docs/grafana-cloud/account-management/cloud-portal/).
2. Select your Grafana Cloud stack.
3. In your Grafana Cloud stack, expand **Observability &gt; Cloud Provider** in the main menu.
4. Click **Azure**, then click the **Configuration** tab.
5. Select **Serverless** for how to configure Azure.
6. Click the **Azure Metrics** tile.
7. At the Azure credentials page, click **Add new credential**.

## Configure access for Grafana Cloud

After you have navigated to the Azure serverless page in Cloud Provider, you need to grant Grafana Cloud the proper authorization to pull data from your Azure Subscription.

To configure access for Grafana Cloud to access your Azure metrics:

1. Click **Setup instructions**.
2. Follow the steps to create a service principal with the `Azure Monitoring Reader` role, using the Azure CLI.

To export metrics from Azure, Grafana Cloud needs authorization to pull data from your Azure Subscriptions. Grafana Alloy uses the Azure SDK for Go which has multiple options for configuring authentication to Azure, including but not limited to the following options:

- a service principal with environment variable
- a workload identity
- a managed identity

Whichever option you choose, the identity that you use must have the `Azure Monitoring Reader` role for any Azure Subscriptions you are trying to monitor.

Refer to the various options for configuring authentication in [Azure documentation](https://learn.microsoft.com/en-us/azure/developer/go/azure-sdk-authentication?tabs=bash#2-authenticate-with-azure).

## Connect to Azure account

After you have configured access for Grafana Cloud to gather your Azure metrics, you need to connect your Azure account in Cloud Provider.

To connect your Azure account in Grafana Cloud:

1. Enter the **Name** you want to give to your new credential.
2. Enter the **Client id** you want to create the credential for.
3. Enter the **Client secret**.
4. Enter the **Tenant id**.
5. Optionally, add tags. By default, resource information including tags are available on the `target_info` metric. When you add a tag here, you can add tags to your Azure Monitor metrics or filter the Azure Monitor metrics collected by tags.
6. Optionally, add static labels for easier filtering and grouping. Static labels are added to all metrics exported by this credential. For more information, refer to [Set static labels](#set-static-labels).

## Set static labels

Static labels are key-value pairs applied to all metrics collected from this credential. Use static labels to filter and group metrics in Grafana Cloud—for example, to distinguish metrics from different environments or teams.

To add a static label:

1. In the **Static labels** field, enter a label key using the `static_label_key` placeholder as a guide.
2. In the adjacent value field, enter a label value using the `static_label_value` placeholder as a guide.
3. Click **Add**. The label appears in a table below the input fields showing the **Keys** and **Values** you have added.
4. Repeat for each additional label you want to add.

To remove a static label, click the delete icon next to the label in the table.

**Static label requirements:**

- Label keys and values must be compatible with the [Prometheus data model specification](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
- Label keys must start with a letter or underscore and may contain only letters, numbers, and underscores.
- Label keys must not start with `__` (double underscore), which is reserved for internal use.
- Each label key must be unique within a credential. Adding a key that already exists has no effect.

> Note
> 
> Static labels apply to all metrics from this credential. To apply different labels to different sets of Azure resources, create separate credentials.

When querying metrics in Grafana, filter by static labels using PromQL label matchers. For example, if you added the label key `environment` with value `production`:

promql ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```promql
{job=~"cloud/azure/.+", environment="production"}
```

## Configure metrics

To configure metrics, select one of two ways for your credential to get data into Grafana Cloud:

- **Autodiscovery:** This option adds all resources found in the provided Azure account to Grafana Cloud.
- **Setup manually:** This option allows you to select specific resources and metrics from the Azure account provided to send to Grafana Cloud.

### Autodiscovery

When you use autodiscovery:

- Cloud Provider Observability automatically discovers all supported Azure resource types in your subscriptions
- New resources are detected within one hour and automatically added to metric collection
- Resources that are deleted or stopped are automatically removed from collection
- Metrics are collected every two minutes using the Azure Monitor Metrics Batch API
- All available metrics for each discovered resource are collected by default

To use autodiscovery to configure your Azure serverless metrics:

1. Choose **Autodiscovery** to add all resources found in the provided Azure account to Grafana Cloud.
2. Click **Create credential** to finish creating your configuration and to begin collecting metrics.

### Setup manually

To manually setup your Azure serverless metrics:

1. Select **Setup manually**.
2. In the **Subscription id** box, enter the subscription id you want to get data for.
3. Optionally, select which resources to get for the current subscription ID. If you do not specify resources, all resources associated with this subscription ID are included.
4. Optionally click **Edit Metrics** for the selected resources to customize which metrics, aggregations, and dimensions are sent. If you do not customize the metrics, all discovered available metrics, aggregations, and dimensions are included.
5. Optionally, add additional subscription IDs.
6. Click **Create credential** to finish creating your configuration and to begin collecting metrics.

## Install dashboards and alerts

> Note
> 
> If you have the Viewer Grafana Cloud basic role or have no Grafana Cloud basic role assigned to you, you must have the `Dashboards:Writer` and `Folders:Writer` fixed roles assigned to you to install dashboards and alerts, and access folders. If you are not assigned a Grafana Cloud basic role, you must have the `Datasources:Reader` fixed role to see dashboard data. For more information on assigning roles, refer to [Assign RBAC roles](/docs/grafana/latest/administration/roles-and-permissions/access-control/assign-rbac-roles/#assign-rbac-roles).

To install and view your Azure preconfigured dashboards and alerts:

1. After configuring Azure metrics, click the **Configuration** tab at the top of the Cloud Provider Azure page.
2. Scroll down to the **Dashboards and Alerts Installation** section and click **Install dashboards and alerts**.
3. Click the **Services** tab.
4. Locate and click the specific service you want to see a dashboard for in the Service column. Use the **Service** or **Source** filters to help you find the source or service you want to see.
