Unable to delete Azure resource tag from few resources like Microsoft insights using Azure Portal

Recently worked on an issue where I was not able to remove resource tags from couple of resources using azure portal. The specific resource type was microsoft.insights\scheduledqueryrules. Selecting the resource and clicking on the three dots -> click Edit tags -> try to remove the tag, you will get a notification saying that its successfully deleted but when you check the tags on the resource its not removed. I had a ticket logged with MS product team for this issue and they suggested below workaround.

To delete the tag from microsoft.insights\scheduledqueryrules when its not getting deleted using azure portal. Please follow below steps:

GET the resource output in Json Code

Scheduled Query Rules – Get (Azure Monitor) | Microsoft Docs

Click on Try it

Sign in -> Provide resourcegroupName, ruleName which 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. Just the tag which you need to delete, remove it from the code. The code will be used in the PUT request as shown in the next section.

Using PUT request to update the resource tag

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

Scheduled Query Rules – Create Or Update (Azure Monitor) | Microsoft Docs

Click on Try it

Enter the parameters, clear the body section and paste the modified Json code from the notepad without the rouge / incorrect tag into the Body Section and Click Run. Unwanted tag will be removed from the resource.

Subscribe to Stay Connected

Thank you for visiting TechPress πŸ‘. When you subscribe to the blog, email notification βœ‰ will be sent to you when a new blog post is published. You can unsubscribe at any time.

Inline Feedbacks
View all comments