How to create a webhook subscription to an event grid topic

Johan Kumps 0 Reputation points
2024-04-05T18:01:40.63+00:00

Hello,

I have a MQTT broker enabled in event grid. My MQTT messages get routed to an event grid topic. Now I want a subscribtion to this topic with a webhook. I used this command :

az eventgrid event-subscription create --name mysubscription --source-resource-id /subscriptions/a4706f53-c1d9-4368-98e0-c7e61fb8a876/resourceGroups/khc_johan_kumps/providers/Microsoft.EventGrid/namespaces/eg-paragon/topics/drones --endpoint https://apim-khc.azure-api.net/eventgrid/receive

But I keep getting this error:

Operation failed with status: 'Not Found'. Details: 404 Client Error: Not Found for url: https://management.azure.com/subscriptions/a4706f53-c1d9-4368-98e0-c7e61fb8a876/resourceGroups/khc_johan_kumps/providers/Microsoft.EventGrid/namespaces/eg-paragon/topics/drones/providers/Microsoft.EventGrid/eventSubscriptions/mysubscription?api-version=2020-04-01-preview

Thanks for helping me out. This is blocking me for 2 days now...

Johan,

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

1 answer

Sort by: Most helpful
  1. JananiRamesh-MSFT 27,921 Reputation points
    2024-04-17T14:04:14.89+00:00

    @Johan Kumps Thanks for reaching out, Form the description I understand that as per this doc https://learn.microsoft.com/en-us/azure/event-grid/mqtt-routing#azure-portal-configuration you have enabled MQTT broker for your event grid and sending all your MQTT messages to an Event Grid topic and using Event Grid subscriptions to deliver the messages to your APIM endpoint (https://apim-khc.azure-api.net/eventgrid/receive) correct me if I am wrong here.

    I tried creating the subscription for my topic in Azure portal with the same endpoint and it got created successfully, I see the resource id you have used is inccorect /subscriptions/a4706f53-c1d9-4368-98e0-c7e61fb8a876/resourceGroups/khc_johan_kumps/providers/Microsoft.EventGrid/namespaces/eg-paragon/topics/drones

    it should be /subscriptions/a4706f53-c1d9-4368-98e0-c7e61fb8a876/resourceGroups/khc_johan_kumps/providers/Microsoft.EventGrid/topics/drones please try this and let me know if the issue resolves / you can also try creating using Azure portal.

    do let me know incase of further queries, I would be happy to assist you.

    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.