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.
Before you begin
- You have a Grafana Cloud account.
- You have either the Admin Grafana Cloud basic role or the Azure Writer plugin role for your stack. For steps to assign RBAC roles, refer to 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 Readerrole assigned. If you need to create one, follow the steps in 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:
- Navigate to your Grafana Cloud Portal.
- Select your Grafana Cloud stack.
- In your Grafana Cloud stack, expand Observability > Cloud Provider in the main menu.
- Click Azure, then click the Configuration tab.
- Select Serverless for how to configure Azure.
- Click the Azure Metrics tile.
- 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:
- Click Setup instructions.
- Follow the steps to create a service principal with the
Azure Monitoring Readerrole, 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.
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:
- Enter the Name you want to give to your new credential.
- Enter the Client id you want to create the credential for.
- Enter the Client secret.
- Enter the Tenant id.
- Optionally, add tags.
By default, resource information including tags are available on the
target_infometric. When you add a tag here, you can add tags to your Azure Monitor metrics or filter the Azure Monitor metrics collected by tags. - 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
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:
- In the Static labels field, enter a label key using the
static_label_keyplaceholder as a guide. - In the adjacent value field, enter a label value using the
static_label_valueplaceholder as a guide. - Click Add. The label appears in a table below the input fields showing the Keys and Values you have added.
- 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.
- 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:
{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:
- Choose Autodiscovery to add all resources found in the provided Azure account to Grafana Cloud.
- Click Create credential to finish creating your configuration and to begin collecting metrics.
Setup manually
To manually setup your Azure serverless metrics:
- Select Setup manually.
- In the Subscription id box, enter the subscription id you want to get data for.
- 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.
- 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.
- Optionally, add additional subscription IDs.
- 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:WriterandFolders:Writerfixed 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 theDatasources:Readerfixed role to see dashboard data. For more information on assigning roles, refer to Assign RBAC roles.
To install and view your Azure preconfigured dashboards and alerts:
- After configuring Azure metrics, click the Configuration tab at the top of the Cloud Provider Azure page.
- Scroll down to the Dashboards and Alerts Installation section and click Install dashboards and alerts.
- Click the Services tab.
- 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.
Manage Azure credentials and metrics
Credentials are how you connect your Azure account with Grafana Cloud so you can send your Azure Metrics to Grafana Cloud. You can add, edit, or delete Azure credentials and the resources and metrics you pull from the Azure account.
Add credentials
To add an Azure credential:
- From the Configuration tab in Cloud Provider Azure, click the Azure Metrics tile.
- Click Add new credential.
- Follow the instructions for configuring access for Grafana Cloud to gather your Azure Metrics.
You have several options for creating an identity.
The identity you use must have the
Azure Monitoring Readerrole. - Enter your Azure account information. For more details, refer to Connect to Azure account.
View credentials and metrics configuration
To view Azure credential details, including the resources and metrics being pulled:
- From the Configuration tab in Cloud Provider Azure, click the Azure Metrics tile.
- Click the Credential name of the credential you want to view.
- Click Resources to expand the section and see the resources you are pulling metrics from in Azure.
- Click the View button of a resource to view the specific metrics being pulled for that resource.
Edit credentials and metrics configuration
To edit Azure credential details or the resources and metrics being pulled:
- From the Configuration tab in Cloud Provider Azure, click the Azure Metrics tile.
- Click the Credential name of the credential you want to edit.
- Click the Actions button.
- Select Edit.
- On the Edit credential page, make your changes.
You can complete the following tasks from this page:
- update the Azure account information
- add, update, or remove static labels
- add, update, or remove Azure formatted tag keys and values
- add or delete subscription ids
- add or delete resources from the subscription
- add, updating settings for, or delete metrics pulled from resources
- Click Save credential.
Delete credentials
To delete Azure credentials:
- From the Configuration tab in Cloud Provider Azure, click the Azure Metrics tile.
- Click the Credential name of the credential you want to delete.
- Click the Actions button.
- Select Delete.
- Click the Delete button.


