Recently, I encountered an issue of not being able to remove tags from a few azure resources on Azure portal. This issue was specific to a particular resource type, microsoft.insights\scheduledqueryrules.
When trying to remove tags by selecting the resource, clicking on the three dots > Edit tags and trying to delete the tag, a notification will show that it’s 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 got below workaround to fix this issue.
1. GET the Resource Output in Json Code
- Go to the Resource URL: Scheduled Query Rules.
- Click on Try it.
- Sign in > Provide resourcegroupName, ruleName (resource name), subscriptionId will be automatically populated when you sign in. Make sure it’s a GET request. Click on Run.
- After you click on Run, scroll down the page to see the output, which would be in Json format. You can check the resource tags applied on the resource in the output.
- We want to delete a resource tag called Enviornment, which is as you noticed it’s misspelled. Therefore, first Copy the Json code into a notepad and edit the code to fix the incorrect tag, keep rest of the code exactly the same. 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.
- Go to the link: Scheduled Query Rules.
- Click on Try it.
- Enter the parameters, clear the body section, and paste the modified JSON code from the notepad in the Body section. Then, click Run and the unwanted tag will be removed from the resource.