Forum Discussion

MarcVDH's avatar
MarcVDH
Iron Contributor
Sep 02, 2025

Cannot delete a tag added through an Asset rule

Hello,

We had created in the past an asset rule to assign a tag to a few machines. Now we are trying to remove the tag but we can't find the right way.
We have delete the Asset rule. (it was turned off more than 2 months ago)
When I go to the machine details and click on 'Manage tags', I can see a section called 'Manual tags' (there I can add remove tags from the console) and a section called 'Rule-based tags' with the description 'Rule-based tags are automatically added to devices based on rules that you create. You can add, edit or delete a rule in Manage rules.'



Going through powershell and the API, it doesn't work either. Even getting the details from a machine only shows the manual tags.

How do we remove then such a tag ?

Thanks in advance for your help.

Marc

3 Replies

  • Ankit365's avatar
    Ankit365
    Iron Contributor

    this is still a known limitation in Microsoft Defender for Endpoint. Tags created by Asset rules are stored and managed separately from manual tags, and deleting the asset rule itself does not always remove the associated tag from existing devices. When an asset rule is deleted, the tag remains attached in the database as a stale rule-based tag, but because it no longer has a linked rule, it becomes effectively read-only. That is why you cannot remove it from the console, PowerShell, or API.

    Right now, the only reliable way to remove such tags is to recreate the same rule using the same tag name and scope, let it synchronize for a few hours so that the rule re-links to the devices, and then delete the rule again. Once that synchronization completes, the tag is properly removed. This behavior is documented internally, but it has not yet been fully fixed in the product.

    Here is the step-by-step workaround that works consistently:

    Go to Defender portal > Settings > Endpoints > Asset rules.

    Create a new rule using the exact same tag name as the one you want to remove and target the same devices or groups that still show it.

    Wait until those devices report back to Defender (usually within one to two synchronization cycles).

    Delete that recreated rule again. When the rule is removed after being actively linked, the tag disappears from all affected devices.

    There is currently no API method or PowerShell parameter that can force-remove a rule-based tag after the original rule has been deleted. Microsoft has acknowledged this as a service issue and is tracking it for a fix in future Defender platform updates.

    In short, re-create the rule using the same tag, allow it to resync, and then delete it again. That process cleans up the tag from all endpoints. Please hit like if you like the solution.

    • MarcVDH's avatar
      MarcVDH
      Iron Contributor

      Thank you very much for the explanation.
      I will try your workaround.

  • Lucaraheller's avatar
    Lucaraheller
    Brass Contributor

    Here’s what’s happening and how to fix it.

    In Microsoft Defender for Endpoint, rule-based tags are managed entirely through the automation rules (asset rules) engine — not manually. Even after you delete or disable a rule, the tags it created may remain attached to devices until a synchronization or background cleanup occurs. That’s why you still see the tag under Rule-based tags and can’t remove it through PowerShell, the API, or the console.

    Here’s how to remove it properly:

    1. Confirm the rule is really gone
      • In the Defender portal, go to Settings → Endpoints → Device tagging → Manage rules.
      • Check that the rule that originally added the tag has been deleted and isn’t simply disabled.
      • If it’s only disabled, re-enable it, remove the tag assignment inside the rule, and then delete the rule again.
    2. Force a re-evaluation
      • Once the rule is deleted, devices update their tagging status only after the endpoint checks in again.
      • You can trigger a sync on each device:
      • MpCmdRun.exe -Sync

    or wait for the next scheduled Defender for Endpoint heartbeat (usually every 30–60 minutes for active devices).

    1. If the tag persists after 24 hours
      • Create a temporary rule with the same name and conditions, but no tag assigned.
      • Let it run long enough for affected devices to check in and overwrite the tag data.
      • Then delete the temporary rule. This usually forces Defender to clear the orphaned tag entry.
    2. Manual deletion is not supported
      • The API and PowerShell cmdlets only manipulate manual tags.
      • The “rule-based” tags are read-only at the device level because they come from the backend service logic.

    If you confirm the rule no longer exists and the tag still shows after a full day of device check-ins, open a support ticket with Microsoft 365 Defender support and include the device ID and tag name. They can trigger a backend tag refresh to remove orphaned entries.

    In short: delete or modify the original rule, wait for device check-in, or recreate a neutral rule to flush the tag. There’s no local or API method to delete a rule-based tag directly.

     

Resources