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:
-
az resource list
: list all the resources in your Azure subscription. -
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). -
az group list
: Use this to list your resources-group to identify the resource group name you created for the event. - 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>
-
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. - 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