Recently I worked on an issue where I couldn’t remove resource tags from a few resources using the Azure Portal. This problem was specific to the resource type “microsoft.insights\scheduledqueryrules“.
When trying to remove the tag by selecting the resource, clicking on the three dots, choosing “Edit tags” and trying to delete the tag, a notification will show that its successfully deleted. However, upon checking the resource’s tags, the tag was not removed. I opened a support ticket with the Microsoft product team, and they provided the following workaround.
Let’s check the steps:
1. GET the resource output in Json Code
- Visit the URL: Scheduled Query Rules – Get (Azure Monitor) | Microsoft Docs
- Click on Try it
- Sign in -> Provide resourcegroupName, ruleName that is your resource name, subscriptionId will be automatically populated when you signin. Make sure its a GET request. Click on Run.
- After you click on Run, scroll down the page to see the Body of the output which is a Json Code. You also can check the resource tags applied on the resource in the Json File.
- We want to delete a resource tag called Enviornment which is as you noticed its misspelled. Therefore, First Copy the Json Code into a notepad and edit the code to delete the line with incorrect tag, keep rest of the code exactly the same.
- Simply remove the tag you want to delete from the code. This code will be used in the PUT request, as demonstrated in the following section.
2. Using PUT request to update the resource tag
PUT request will be used to update the resource and delete the unwanted tag.
- Click on Try it
- Enter the parameters, clear the body section, and paste the modified JSON code from the notepad, excluding the incorrect tag, into the Body Section. Then, click “Run” and the unwanted tag will be removed from the resource.