Problems with MQTT client subscriber and Azure Event Grid

Mark Pope 50 Reputation points
2025-04-07T23:41:24.9833333+00:00

I have two MQTT Java clients that are using different Service Principals for authentication, a publisher and a subscriber. The subscriber uses and async class that listens and should print out received MQTT messages. When I publish 10 MQTT message from the publisher the subscriber does not receive them. My Topic and Event Hub get the 10 MQTT messages.

I have created a subscriber and publisher topic space. Each has a template with #. I assume this will allow any messages to be published and consumed.I have created permission bindings for each for Publisher and Subscriber, both use Client Group $all.

The correct roles have been applied.

One thing I have notice is under Entra ID -> Monitoring -> Sign-in logs for Service Principals I only see entries for my Publisher and not my Subscriber. I corrupted my Subscriber credential to make my client fail upon connection to ensure it wasn't hiding an auth failure. I'm at a loss for further debugging.

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

2 answers

Sort by: Most helpful
  1. Shireesha Eeraboina 2,815 Reputation points Microsoft External Staff
    2025-04-08T06:48:15.4466667+00:00

    Hi Mark Pope,

    It seems that your subscriber client may not be connecting properly to the Azure Event Grid namespace. Here are a few things you can check:

    • Ensure that the subscriber client has the correct client identity entry created with the service.
    • Verify that the authentication credentials for the subscriber are configured correctly.
    • Check if the subscriber client is part of the correct client group with subscriber permissions on the topic space.
    • Make sure that the subscriber client is using a unique Client ID and that the topic to which it is subscribing exists.

    Since you mentioned that you only see entries for the publisher in the Entra ID sign-in logs, it indicates that the subscriber may not be connecting at all.

    To help you better understand, kindly refer to the documentations below:

    I hope this addresses your query. Please let me know if you need any further assistance or clarification.

    1 person found this answer helpful.
    0 comments No comments

  2. Sander van de Velde | MVP 36,146 Reputation points MVP
    2025-04-09T05:55:26.9133333+00:00

    Hello @Mark Pope ,

    welcome to this moderated Azure community forum.

    It seems your connect via an AAD account.

    Did you provide the 'EventGrid TopicsSpaces Subscriber role to your subscriber?User's image

    Update, the issue is related to system properties:

    ... service principals. They have to be set in the cmd or shell running my Java program. My build tool(maven) allows system properties to be defined before running Java and they were not being set.


    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 Answers by the question author, which helps users to know the answer solved the author's problem.