Automatically forwarding Azure Monitor Autoscale events to Azure Event Grid

Learn how you can forward Azure Monitor Autoscale events to Azure Event Grid by using a simple adapter.

Automatically forwarding Azure Monitor Autoscale events to Azure Event Grid

Autoscaling is one of my passions, it's an interesting area to work in and only recently I've noticed that the majority of my contributions are focused on that area as well.

Promitor started as a way to bring Azure Monitor metrics in Prometheus so that I could scale on them, I started contributing to KEDA to make autoscaling on Kubernetes dead-simple and last month I've released Kubernetes Event Grid Bridge, a way to get Kubernetes events in Azure Event Grid so that I could have autoscaling awareness.

One area that is lacking in the list is Azure Monitor Autoscale, a PaaS autoscaler for your Azure workloads.

Azure Monitor Autoscale

If you ask me what the ideal autoscaler is, then Azure Monitor Autoscale is a good example because it does not only make autoscaling easy, it also provides a scaling history, notifications, and log of the actions taken.

Having autoscaling awareness is essential to detect autoscaling loops, tweak them because they can be too aggressive or passive, etc.

Want to have an overview of how it works? Then I recommend reading my other blog post:

Autoscaling your platform with Azure Monitor
> TL;DR - Autoscaling is a great way to not only optimize your costs but also aflexible way of doing asynchronous processing.We will look at how Azure MonitorAutoscale allows you to define autoscaling rules, what the caveats are and whatwould be good additions to the service Building scalable s…

The limitations of Azure Monitor Autoscale's notifications

Azure Monitor Autoscale allows you a variety of ways to get notified when scaling actions are taken such as sending emails, webhooks, etc.

Here's an example of how you can configure this:

But one thing is missing here, support for Azure Event Grid. Instead of having to configure every system that wants to be notified, it would be nice if you could standardize on Azure Event Grid and build on that instead.

Not only will it open up the information that is being sent, but you can also monitor who is subscribing on them, filter to only a subset of resources, only subscribe for scale in, etc.

But why wait? Let's show the way!

Azure Event Grid adapter for Azure Monitor Autoscale

The Azure Event Grid adapter for Azure Monitor Autoscale uses Azure Logic Apps to receive notifications from Azure Monitor Autoscale, transforms the payloads into CloudEvents, and forwards them to Azure Event Grid.

That way, all our internal systems can subscribe to Azure Event Grid and choose if they want to receive events for all configured scaling rules, and/or what event types they want:

  • Azure.Monitor.Autoscale.ScaleIn.Activated
  • Azure.Monitor.Autoscale.ScaleOut.Activated

You can easily deploy it to your own subscription:

Deploy to Azure

Using Azure Event Grid as your centralized hub for autoscaling events

By using this adapter in conjunction with Kubernetes Event Grid Bridge, we are creating a centralized hub for all autoscaling events in your Azure platform.

This allows you, as a user, to fully standardize on CloudEvents and not have to worry where you should get the autoscaling information, it will come to you!

If you like these events, please vote for them here and here so that they can hopefully become part of the Azure Monitor Autoscale runtime.

Thanks for reading,

Tom Kerkhove

Photo by Denis Degioanni on Unsplash