Mass deletion depends on what kind of Azure Arc resource the 300 instances are (servers, SQL Server instances, SQL managed instances, data controllers, etc.). The context provides supported bulk options for Arc-enabled SQL Server and Arc-enabled data services.
If the 300 instances are SQL Server - Azure Arc resources:
- Option 1 – Delete the entire resource group (all Arc SQL resources)
Use this only if the resource group is dedicated to these Arc resources.
- In Azure portal:
- Browse to the resource group that contains the Arc SQL resources.
- Select Delete resource group.
- Confirm by entering the resource group name and select Delete.
- Option 2 – Delete specific Arc SQL resources in a resource group (portal)
- In Azure portal:
- Browse to the resource group where the SQL Server - Azure Arc resources are.
- Select all the Arc SQL resources (and any dependent resources such as Arc databases) that need to be removed.
- Select Delete and confirm.
- Option 3 – Delete Arc SQL instances at scale using PowerShell
After uninstalling the Azure Extension for SQL Server from the connected machines (if needed):
- Uninstall the extension from each connected machine (can be scripted):
Remove-AzConnectedMachineExtension -MachineName "{your machine name}" `
-ResourceGroup "{your resource group name}" `
-Name "{extension name}" -NoWait
For Windows machines, extension name is WindowsAgent.SqlServer; for Linux, LinuxAgent.SqlServer.
- Remove each SQL Server - Azure Arc resource (can be looped in a script):
remove-azresource -ResourceGroup "{your resource group name}" `
-ResourceType Microsoft.AzureArcData/SqlServerInstances `
-Name "{full SQL instance name}" -Force
Script these commands over the list of 300 instance names to perform a mass delete.
If the 300 instances are Azure Arc-enabled SQL managed instances or data controllers:
- If using direct connectivity mode
- Use the Azure portal to delete:
- Browse to the resource group and delete the Azure Arc data controller and managed instances as needed.
- On the Arc-enabled Kubernetes cluster, go to Extensions, select the
microsoft.arcdataservices extension, and Uninstall.
- Optionally delete the Custom Location and any dedicated Kubernetes namespace.
- If using indirect connectivity mode
Deletion is a two-step process (Kubernetes and Azure are independent):
- Delete instances from Kubernetes (source of truth) using Kubernetes tools.
- Then delete the Azure resources in bulk:
- Delete entire resource group (portal):
- Browse to the resource group with the Arc data services resources.
- Select Delete resource group and confirm.
- Delete specific resources (portal):
- Browse to the resource group.
- Select all Arc SQL managed instances and/or data controllers to remove.
- Select Delete, type
yes, and confirm.
- Delete via Azure CLI at scale:
- Delete all Arc SQL managed instances in a resource group:
az resource delete --name <sql instance name> \
--resource-type Microsoft.AzureArcData/sqlManagedInstances \
--resource-group <resource group name>
- Delete Arc data controllers:
az resource delete --name <data controller name> \
--resource-type Microsoft.AzureArcData/dataControllers \
--resource-group <resource group name>
Loop these commands over the list of 300 resources in a script to perform mass deletion.
For any mass delete, ensure that required billing/usage data is exported and uploaded (for Arc data services) before deletion, and be aware that deleting resource groups or controllers is irreversible.
References: