Reader

Bring your Microsoft Azure metrics and logs to Grafana Cloud—no Alloy required

| engineering on Grafana Labs | Default

Grafana Alloy, our distribution of the OpenTelemetry Collector with native support for Prometheus, is great for all sorts of needs, including shipping your Microsoft Azure metrics and logs to Grafana Cloud. And as much as we love Alloy here at Grafana Labs, let’s face it, the amount of Alloy configuration required to observe your Azure environments is just too much:

A GIF showing all the lines of code used to configure Alloy

In this example, we used Alloy with the prometheus.exporter.azure and loki.source.azure_event_hubs components to connect multiple Azure services to our Cloud Provider Observability solution in Grafana Cloud. This required over 500 lines of Alloy configuration, but afterwards the solution lit up using our service discovery and out-of-the-box experiences. 

Now you can get the same results and more with our new serverless features for Azure metrics and logs. They’re designed to provide a low-friction onboarding experience so you can start observing your Azure environments in no time. On top of that, we also provide insights you can’t get out of the box with Azure Monitor, helping to ensure you never run out of IP addresses in your Azure Virtual Networks and letting you know when you need to scale your Azure Event Hubs.

Let’s dive into how it all works.

How to use the serverless feature to collect Azure metrics

Prior to releasing our new serverless feature, the standard Alloy setup would use the Azure Resource Graph API to identify resources for metric collection. After identifying resources, Alloy would use Azure Monitor APIs to gather metric data. After the metric data is gathered, that data would be written to Grafana Cloud Metrics. The diagram below helps illustrate this flow.

A workflow using prometheus.exporter.azure

But now you can drop Alloy and let Grafana Cloud run it for you! 

As a part of developing our serverless feature, we built a brand new Azure Prometheus exporter. Building a new exporter allowed us to include some major improvements to the Azure exporter currently used by Alloy. Here’s a few of the big improvements:

  • We use the Azure Monitor Metrics Batch API, which eliminates problematic rate limiting errors that can prevent you from properly observing your Azure environments
  • No need to tell us what resource types and metrics to collect; we’ll discover it all automatically
    • Azure Resource Graph is used to discover all Azure subscriptions and resource types available
    • We then use Azure Monitor to list available metrics for those resources and start pulling
  • We continuously refresh what we pull, allowing for new resource types and metrics to be recognized automatically—no configuration changes required
  • We use Azure Resource Graph to generate valuable resource metrics you cannot get from Azure Monitor:
    • Virtual Networks metrics so know when you might be running out of addresses with:
      • Total peerings and connected peers
      • Available IP addresses to the Virtual Network
      • Total subnets
      • Number of assigned and available IP addresses for a subnet
      • Event Hubs metrics so you know when it might be the right time to scale with:
    • The tier of the event hub
      • Current throughput units for basic and standard tier
      • Maximum throughput units when auto inflate is enabled
      • The processing units for premium tier

The resulting flow is largely the same as running Alloy yourself, except it all happens in Grafana Cloud. You don’t need to set up or manage any additional infrastructure.

A workflow for the serverless configuration

And if you want to keep managing Alloy for Azure metrics, don’t worry, you won’t be forgotten. We plan to  replace the Alloy Azure exporter with our new one, along with open sourcing it. This way you get to pick what works best for you: serverless, Alloy, or running the exporter yourself. 

The serverless feature supports all of the resource types available in Azure Monitor, and you can read more about it on our supported resource types page. So if you’re ready to replace your unwieldy Alloy configuration describing every Azure metric you need to collect, you can do so with less than 10 lines of Terraform code:

resource "grafana_cloud_provider_azure_credential" "azurecred" {
provider = grafana.cloud_provider
stack_id = data.grafana_cloud_stack.current.id
name = var.credential_name
client_id = azuread_application.grafana_cloud_azure_metrics.client_id
client_secret = azuread_application_password.grafana_cloud_azure_metrics.value
tenant_id = data.azurerm_client_config.grafana_cloud_azure_metrics.tenant_id
}

Our setup documentation will guide you through our as-code-centric process, allowing you to bring your Azure metrics to our Cloud Provider Observability solution in no time.

A list of Azure services displayed in Grafana Cloud

How to use the serverless feature to collect Azure logs

We also now support the ability to export Azure resource and activity logs into Grafana Cloud in a serverless manner. You can, for instance, use this functionality to monitor Kubernetes events for security breaches by applying Sigma rules.

The new serverless worfklow for logs

We provide an Azure Function that subscribes to an event hub and sends all events to a Loki endpoint. The function can be managed as code as well, making it easy to get started quickly so you’re focusing less on setup and more on getting insights from your logs. Check out our docs for more information on how to get started.

Additionally, you can configure a jq pipeline to filter and preprocess events making it really easy to drop data you might not need before ingestion in Grafana Cloud.

What’s next for Cloud Provider Observability?

With the Cloud Provider Observability solution, we support all three major cloud platforms: AWS, Azure, and Google Cloud. This gives you a unified experience to manage all your cloud environments and streamline your monitoring and troubleshooting.

The team is hard at work adding support for AWS Metrics Streams, but there’s still plenty more to come for Azure including:

  • UI based configuration in the Cloud Provider app
  • Add more valuable resource generated metrics that cannot be found in Azure Monitor
  • Adding Open Telemetry support to our Azure Logs function to enable delivering logs to non-Loki backends
  • Open sourcing our new Azure Metrics exporter bringing all the benefits to the community and our Alloy users

Grafana Cloud is the easiest way to get started with metrics, logs, traces, dashboards, and more. We have a generous forever-free tier and plans for every use case. Sign up for free now!