Welcome to Part 2 of Azure functions: What are they good for? In Part 1, we did a quick review of what Azure Functions were and focused on the trigger aspect of Functions.  By focusing on the triggers, we were able to highlight different scenarios that best suited an Azure Function’s usage. Let’s pick up where we left off in part 1, which covered the HTTP/WebHook trigger, Timer trigger, Azure Blob Storage trigger, and the Azure Queue Storage trigger. In this post, we will be exploring usages for the Azure Service Bus Queue/Topic trigger, Azure Event Hub trigger, IoT Hub (Event Hub) trigger, Azure Event Grid trigger, and last but not least, the Azure Cosmos DB trigger.

Azure Service Bus Queue/Topic Trigger

The Azure Storage Queue is not the only queue service with Azure Function triggers. The more robust Service Bus executes its trigger whenever a message is added to a specific Service Bus Queue or Service Bus Topic.

Azure Event Hub Trigger

Event Hubs are triggered whenever a new event is received.

  • Streaming at Scale with Azure Event Hubs, Functions and Cosmos DB (view some code)
  • Read Temperature data from Event Hub messages (view some code)
  • Matchmaking system using Azure Functions and Redis (view some code)

Azure IoT Hub (Event Hub) Trigger

The IoT Hub trigger is tied to Event Hubs in that this trigger will run whenever an IoT Hub delivers a new message for Event Hub-compatible endpoints.

Azure Event Grid Trigger

Rounding out our list of event-based triggers is the Event Grid trigger. This trigger is fired whenever an Event Grid receives a new event.

  • Subscribing an Azure Function to Event Grid events via Terraform (view some code)
  • Performing Azure Machine Learning via a No Code Deployment in Python (view some code)

Cosmos DB Trigger

The Cosmos DB trigger uses the Azure Cosmos DB Change Feed to listen for inserts and updates inside of a document collection. A very important detail to note is that the change feed publishes inserts and updates, but not deletions.

In the list of use cases, something in particular needs to be called out.  That call-out goes towards highlighting the incredible flexibility of Azure Functions, this time in regards to programming languages. Azure Functions are not restricted to the .Net language, as can be seen by the Python and Java examples listed. Azure Functions support a variety of languages including .Net (C# and F#), JavaScript/TypeScript, Java, Python, and even PowerShell. The flexibility of Azure Functions doesn’t just lend itself to use cases but also programming styles.

This post concludes a review of some use cases for Azure Functions. Part 1 & 2 should serve as inspiration for how Azure Functions can connect other Azure resources, be included as part of a process or workflow, and in general help round out a solution.