Azure Arc Agents Keeps coming back after deletion

Ariel Arivara 1 Reputation point
2025-11-21T00:05:57.1133333+00:00

Hi,

I am getting issue with the Azure Arc going back after deletion. When I am trying to open the resource, I get this error:

The resource was not found, it may have been deleted. If this was launched from a pinned tile on the dashboard, it should be removed.

Status Code: 404

Though when I tried Azure CLI, it returns to none so those seems to be deleted successfully.

az resource list \

--resource-group "my resource group name" \

--query "[?type=='Microsoft.HybridCompute/machines' || type=='Microsoft.AzureArcData/sqlServerInstances'].name" \

Thanks.

Azure Arc
Azure Arc
A Microsoft cloud service that enables deployment of Azure services across hybrid and multicloud environments.
{count} votes

2 answers

Sort by: Most helpful
  1. Suchitra Suregaunkar 3,545 Reputation points Microsoft External Staff Moderator
    2025-11-21T10:34:16.6366667+00:00

    Hello Ariel Arivara

    Thank you for posting your query on Microsoft Q&A platform.

    You are seeing 404 “resource not found” in the portal after deleting Azure Arc resources. Your CLI query returns none, which indicates deletion did succeed. If the Arc resources (servers or SQL instances) keep coming back, the usual cause is:

    Auto‑provisioning/Policy is re‑onboarding the agents/extensions, or the Connected Machine agent on the server is still connected and recreates the Arc resource, or the Azure Extension for SQL Server is auto‑installing and re‑registering instances.

    Try below resolution steps as a workaround (do these in order):

    Confirm deletion (you already did): Use the direct type filter (your command is correct). If this returns empty, the resources are gone at ARM level.

    az resource list \
      --resource-group "<RG>" \
      --query "[?type=='Microsoft.HybridCompute/machines' || type=='Microsoft.AzureArcData/sqlServerInstances']"
    

    Portal 404 on pinned tiles is expected, remove the pinned tile and refresh.

    Reference: https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-not-found?tabs=bicep

    Disable anything that auto‑onboards Arc/agents : Defender for Cloud auto‑provisioning applies DeployIfNotExists policies behind the scenes and can re‑install AMA/MDE/Guest Configuration, effectively re‑creating Arc connectivity.

    Disable anything that auto‑onboards Arc/agents:

    Defender for Cloud auto‑provisioning applies DeployIfNotExists policies behind the scenes and can re‑install AMA/MDE/Guest Configuration, effectively re‑creating Arc connectivity.

    • In Defender for Cloud → Environment settings → your subscription → Settings & monitoring, set relevant Auto‑provisioning toggles (Azure Monitor Agent, endpoint/guest configuration, etc.) to Off. This stops policy‑driven re‑deployment.
    • If you use Azure Policy directly, remove/disable initiatives such as “Use Azure Policy to install Azure Monitor Agent” (and related DCR association policies) at subscription/RG scope. These built‑ins deploy AMA to Arc machines and can bring the resource back.

    Reference: https://learn.microsoft.com/en-us/azure/azure-monitor/agents/azure-monitor-agent-policy

    Disconnect the local agent, then uninstall it: If the Azure Connected Machine agent remains connected, it will recreate the Arc resource.

    Disconnect on the server:

    # If the cloud resource is already deleted:
    azcmagent disconnect --force-local-only
    
    # Verify:
    azcmagent show
    
    

    Use --force-local-only when the cloud resource is gone to avoid unintended deletions.

    Reference: https://learn.microsoft.com/en-us/azure/azure-arc/servers/azcmagent-disconnect

    Uninstall/Clean up the Connected Machine agent following the official Manage and maintain the agent guidance (Windows or Linux)

    Reference: https://learn.microsoft.com/en-us/azure/azure-arc/servers/manage-agent?tabs=windows

    Clean up the portal view: Remove any pinned dashboard tiles pointing to the deleted resources and hard‑refresh the portal (Ctrl+F5). The 404 simply reflects a stale reference after deletion.

    Kindly let us know if the solution provided worked for you. If you need any further assistance, please feel free to reach out.

    Thanks,

    Suchitra.


  2. Ariel Arivara 1 Reputation point
    2025-11-23T11:36:21.5566667+00:00

    Thanks, @Suchitra Suregaunkar. The resources are now deleted on my subscription. I think it just needs time for it to be removed completely in the Azure Portal.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.