@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