Unable to delete Event Subscription

Sai k Marthi 20 Reputation points
2024-04-29T08:40:09.9333333+00:00

I tried to create event subscription for Azure Event Grid Name space. I am a bit new to Azure so I messed up and chose storage queue as endpoint as at that time I dont know how to create event gris system topic and namespace.

Then I deleted that queue without removing the event subscription in IoT Hub. Now after doing some research, I got to know how to create name space and system topic and link it with IoT Hub. But may be due to above mess-up, I am unable to do any operation on Event Subscription. It's through error such as below when deleting.

User's image

If i try to change below message is popping up.

User's image

Another one I tried is creating new event grid namespace and switch the event subscription endpoint from storage queue to Azure Event grid namespace endpoint system topic but during creation time I create Azure Event Subscription with Event Grid Schema now I am unable to change it.

How to solve this issue please enlighten me and really sorry if I was unable to explain properly. Any information needed I can provide no issues.

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,205 questions
Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
396 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 12,166 Reputation points
    2024-04-29T13:16:55.37+00:00

    Hello @Sai k Marthi

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    Problem

    Sequel to your questions, I understand that you are having trouble handling Event Subscriptions in Azure Event Grid because of an initial setup mistake. You mistakenly linked a storage queue instead of the correct destination in an IoT Hub and you deleted the queue without removing the subscription first and ran into problems trying to change or delete it later. The errors you faced were about disabling publisher notifications and switching the endpoint. You are also, found it tricky to change the Event Subscription's schema from Event Grid to another type.

    Scenario

    Sai, who's new to Azure, tried setting up an Event Subscription for an Azure Event Grid Namespace linked to an IoT Hub. Unfortunately, Sai mistakenly chose a storage queue instead of the correct destination, the Azure Event Grid Namespace system topic, due to being unfamiliar with the platform. Later, Sai deleted the storage queue without removing the Event Subscription first, causing complications. Now, Sai is unable to edit or remove the Event Subscription and is encountering errors when trying to disable publisher notifications and change the endpoint. Additionally, Sai is finding it challenging to switch the Event Subscription's schema from Event Grid to another type.

    Solution

    This prescribed solution was based on the scenario given and your questions, while focusing on the problem statement.

    Don't worry, due to previous mistake; we can work through this. Since you're encountering errors when trying to delete or modify the existing Event Subscription, we need to handle this carefully.

    To ensure the correct event will be selected. You will need to start from listing all the resources in your Azure subscription and ID except you know the exact details, you can jump to the last part. Use the following sequentially in your Azure CLI to gather the information required:

    1. az resource list: list all the resources in your Azure subscription.
    2. az resource list --resource-type "Microsoft.Devices/IotHubs : Filter the list of resources based on specific criteria. For example, if you know the type of resource you're looking for (e.g., IoT Hub).
    3. az group list : Use this to list your resources-group to identify the resource group name you created for the event.
    4. Look for the resource's name and other details to confirm that it's the correct one. Once you've identified the correct resource, you can extract its id property, which represents the <source-resource-id>
    5. az resource show --id <resource-id> --query id --output tsv: Replace <resource-id> with the ID of the resource you identified in the previous step.
    6. Use the below code to "List Event Subscriptions" from Azure CLI:
     az eventgrid event-subscription list --source-resource-id <source-resource-id>
    
    

    Finally

    You can use Azure CLI again to perform the final task, the final task will disable the event.

    az eventgrid event-subscription update --name <subscription-name> --source-resource-id <source-resource-id> --resource-group <resource-group-name> --enabled false
    

    From the information you have gotten from the previous commands, use it to disable the event subscription that you mistakenly created.

    References

    To learn and to read more, kindly use the additional resources available by the right side of this page.

    Source: Partially Microsoft Bing. Accessed, 4/29/2024.

    Accept Answer

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.

    Best Regards,

    Sina Salam


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.