MQTT sparkplug v1.0 to EventGrid how to decode data when forwarding to an EventHub.

Karl Fredrik Wirgenes 0 Reputation points
2025-11-17T20:50:28.3233333+00:00

I am sending sparkplug B MQTT into an Azure eventgrid. The data is then sent to an eventhub using topics.

My problem is that in the eventhub the data format is a Base64 payload decoded according to the sparkplug B protocol. Preferably i want the data decoded before it reaches the eventhub. How can I achieve this using azure services?

Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
{count} votes

1 answer

Sort by: Most helpful
  1. Pashikanti Kumar 1,725 Reputation points Microsoft External Staff Moderator
    2025-11-17T21:17:33.78+00:00

    Hi Karl Fredrik Wirgenes,

    Thanks for reaching out on Microsoft Q&A

    Use Azure Functions or Azure Stream Analytics to decode Sparkplug B protobuf payloads after Event Grid ingestion but before forwarding to Event Hub

    Azure Event Grid subscription triggers an Azure Function

    ·         The Event Grid receives Sparkplug B MQTT messages (still base64 protobuf encoded).

    ·         The Azure Function is triggered by the Event Grid event.

    Azure Function decodes the Sparkplug B protobuf payload

    ·         Use a Sparkplug B protobuf .proto definition and Google Protobuf library to decode the base64 payload into JSON or structured data.

    ·         This converts binary protobuf payloads to readable JSON before any further processing.

    Azure Function publishes the decoded data to Azure Event Hub

    ·         The decoded JSON or clean data is sent to Event Hub.

    ·         Downstream systems consuming Event Hub receive decoded, readable data.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.