I was currently looking for a way to listen to Kafka topics direct from Azure Functions when I found the Kafka bindings are now available for Azure Functions v3+ hosted on Elastic Premium Plan and Dedicated (App Service) plan.
The trigger has been available for preview for a while, but now it is suitable for production: Apache Kafka bindings for Azure Functions | Microsoft Docs
You can add to your Azure Function using Nuget, but it’s also available in Visual Studio 2022 as a template. The wizard will prompt you to enter details like username and password (Confluent cloud), but you can ignore it if your Kafka is hosted on-premises or in containers.

If you click create, you will get this function template similar to the Azure Event Hub Trigger.

Not many have access to Kafka hosted on Confluent cloud. If you want to try it right now and have a locally hosted dev environment, you can run Kafka on Docker: Quick Start for Confluent Platform | Confluent Documentation
You will need a certain amount of hardware to run that and Visual Studio. But it works and is just about to run the docker commands as described. Of course, you need to have Docker installed. You will be able to interact with Kafka through this handy web ui:

The value for “BrokerList” is the url for the “broker” image: “localhost:9092”


Once it’s all in place, add a breakpoint to the Azure Function, hit F5 and send a message to Kafka:

It runs just like it does for Azure Event Hub.

I will publish this now to encourage whoever was looking for this approach to give it a try. I’ll be trying to use this for an actual project and will update this thread later to share more.
Leave a Reply