The orphaned resources are showed in the Azure portal after deleting the Azure Arc SQL Instance.

Bezerra, Itajiba 26 Reputation points
2025-10-15T12:56:12.53+00:00

We have configured and tested the Azure Arc SQL Instance for a SQL instance on premise.

After deleting the Machine Azure Arc, SQL Azure Arc and uninstalling the 2 Azure services in the physical server, the SQL databases remains being showed in the Azure Portal. If I try to click them, an error 404 (Not Found) occurs. The Azure Explorer doesn't show these resources anymore.

How can I clean up the resource group of these orphaned resources?

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

Answer accepted by question author
  1. Bharath Y P 1,515 Reputation points Microsoft External Staff Moderator
    2025-10-16T04:23:17.3833333+00:00

    Hello Bezerra, Itajiba,

    Thanks for the update. Since all Azure Arc-related resources have been removed from your environment, you're now seeing orphaned SQL resources in the Azure Portal. These resources still appear but return to the 404 error when accessed, indicating they no longer exist on the backend.

    The issue with the command you tried az resource delete --name <Name> --resource-type Microsoft.AzureArcData/sqlServerInstances/databases --resource-group <Resource-group-name> is likely due to an incorrectly formed resource type string for the database.

    Azure Arc-enabled SQL Server databases use the full resource type Microsoft.AzureArcData/sqlServerDatabases. These databases are linked to their parent SQL instances, which use the type of Microsoft.AzureArcData/sqlServerInstances. So, to fully remove them, you need to delete both the database and its parent instance. The type you mentioned Microsoft.AzureArcData/sqlServerInstances/databases It seems to be Incorrect format. It looks like a nested path, but Azure treats the database as a separate resource type, not a sub-path under the instance.

    Workaround:

    1. Remove Orphaned Azure Arc SQL Instances and Databases: To clean up SQL resources that still appear in the Azure Portal but are no longer active:
    • List all SQL Instances: These are parent resources. Deleting them will also remove their associated databases.
    az resource list --resource-group <Resource-group-name>\
      --query "[?type=='Microsoft.AzureArcData/sqlServerInstances'].name" \
      --output tsv
    
    • Delete each SQL Instance: For every name returned above
    az resource delete \
      --name <sql-instance-name> \
      --resource-type Microsoft.AzureArcData/sqlServerInstances \
      --resource-group <Resource-group-name>\
      --no-wait
    

    Deleting the parent instance will also remove its associated databases

    1. Remove leftover Azure Arc Machine Resources: These represent the on-premises servers that were connected via Azure Arc.
    • List all Arc Machines:
    az resource list --resource-group <Resource-group-name>\
      
    
    • Delete each Arc Machine: For every machine name returned.
    az resource delete \
      --name <machine-name> \
      --resource-type Microsoft.HybridCompute/machines \
      --resource-group <Resource-group-name>\
      --no-wait
    

    this will also remove any extensions tied to those machines.

    Reference link:

    Delete a SQL Managed Instance enabled by Azure Arc - Azure Arc | Microsoft Learn

    Uninstall Azure Arc-enabled data services - Azure Arc | Microsoft Learn

    Hope this helps. Please let us know if you need further assistance. Thanks

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Bezerra, Itajiba 26 Reputation points
    2025-10-15T14:34:24.77+00:00

    Thanks for your attention.

    • Are the orphaned SQL resources in the same resource group as the original Azure Arc machine, or were they deployed in a separate RG? Yes
    • Do you still have any Azure Arc machines or SQL Arc extensions active in your subscription, or is everything else fully removed? They were fully removed.
    • Are you aiming for a manual cleanup via CLI/Portal, or do you want an automated script that scans the resource group and deletes all orphaned Arc SQL resources? I have tried this command : az resource delete --name WideWorldImporters ` --resource-type Microsoft.AzureArcData/sqlServerInstances/databases ` --resource-group BR_RG
    • Do you want to also remove any leftover Azure Arc machine resources (Microsoft.HybridCompute/machines) along with the SQL entries, or just the SQL ones? Any resources related to Azure Arc
    • Were any of these resources protected by locks or RBAC permissions that might prevent deletion? No. The command "az lock list --resource-group BR_RG --output table" returns nothing.
    0 comments No comments

  2. Bezerra, Itajiba 26 Reputation points
    2025-10-17T12:03:38.1533333+00:00

    Barath,

    I don't know why but after 2 days the orphaned resources disappeared.

    Thanks very much for your attention.

    Itajiba

    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.