How to broadcast to device groups with Event Grid MQTT when clients don’t know their own attributes?

NicholasDyhre-2538 25 Reputation points
2025-08-28T12:11:41.7066667+00:00

Hi,

I’m evaluating Azure Event Grid MQTT (preview) for a large IoT deployment, and I’ve run into a design challenge that I can’t resolve with the current documentation.

My setup

  1. I have many physical devices and device groups (> 10).
  2. Physical devices connect to MQTT clients in azure.
  3. Azure Event Grid MQTT Clients has information not available on the physical devices, such as attributes.

My requirements

  1. Group messaging:
    1. Goal: I want to broadcast messages to groups of devices based on their attributes in Event Grid (e.g., all devices with some_attribute=1 or customerId=42).
  2. Restrictions:
    1. The devices should only receive message from topics that match their attributes, e.g. clients with attributes. customerId=42 should only be able to listen on someTopic/customerId/42. someTopic/customerId/32 should be forbidden.
    2. The physical hardware devices should not be required to know the attributes of azure-MQTT-Client. So when i setup subscription, the number “42” should not be required for the physical device to know.

The problem

  1. Topic Spaces let me define patterns like:
    cloud2device/${client.attributes.customerId}/#
  2. But devices cannot use placeholders like ${client.attributes.customerId} in their subscription filters.
    They must specify the resolved value, which they don’t know.
  3. A client’s attributes can change, but physical devices should remain stateless.

My question

Given these constraints Is there a built-in way for the broker to automatically route messages to clients based on their attributes (without the device knowing the attribute) which will allow me to accomplish group broadcast with Event Grid MQTT?

Any guidance, or confirmation of current limitations, would be much appreciated.

Thanks!

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

Answer accepted by question author
  1. Harish Badijana 320 Reputation points Microsoft External Staff Moderator
    2025-09-02T18:28:46.52+00:00

    @ND

    Azure Event Grid MQTT supports routing messages from clients to Namespace topics or Custom topics

    Once routed, you can configure event subscriptions to push or pull messages to Azure services or custom endpoints. However, this routing is not attribute-aware at the broker level. It does not automatically resolve client attributes to determine delivery eligibility.

    FYI, there is no built-in mechanism in Event Grid MQTT today that allows the broker to automatically resolve client attributes and match them against published topic value. This means your requirement—where a device subscribes generically and the broker filters based on attributes—is not natively supported.

    While not ideal, here are some potential approaches

    Use Event Grid Routing and Azure Functions

    Route all MQTT messages to a central Event Grid topic.

    Use an Azure Function to inspect client attributes and forward messages to appropriate subtopics or endpoints.

    This adds latency and complexity but allows dynamic filtering.

    Custom Broker Layer

    Deploy a custom MQTT broker in Azure.

    Use Azure services to manage attribute-based routing.

    This gives full control but sacrifices native Event Grid integration.

    Push Model via Cloud-to-Device Messaging

    Use cloud-side logic to publish messages to topics like cloud2device/${client.attributes.customerId}/#.

    Clients subscribe to generic topics, and permissions restrict access.

    Still requires clients to know or be configured with resolved topic values.

    I hope this helps in resolving the issue, do let me know if you have any further questions on this

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 36,951 Reputation points MVP Volunteer Moderator
    2025-09-02T14:55:02.4966667+00:00

    Hello @ND,

    welcome to this moderated Azure community forum.

    It seems this 10 client groups limitation is a 'soft limit'.

    It's probably not there because some technology cannot cope with it, it's just a decision from the team because there should be some limit.

    You could try to ask for a new limit by discussing your use case with the product team so they better understand why a different number is needed.

    This can be done by submitting a support ticket.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    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.