Unable to Delete Azure Resource Tag

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

  1. Click on Try it
GET the resource output in Json Code
GET the resource output in Json Code
  1. 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.
GET the resource output in Json Code
GET the resource output in Json Code
  1. 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.
  1. 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.
  1. 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.
GET the resource output in Json Code
GET the resource output in Json Code

2. Using PUT request to update the resource tag

PUT request will be used to update the resource and delete the unwanted tag.

  1. Visit this link: Scheduled Query Rules – Create Or Update (Azure Monitor) | Microsoft Docs
  1. Click on Try it
Using PUT request to update the resource tag
Using PUT request to update the resource tag
  1. 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.
Using PUT request to update the resource tag
Using PUT request to update the resource tag

Leave a Comment

Discover more from TechPress

Subscribe now to keep reading and get access to the full archive.

Continue reading