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:
- 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
- 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