Delete a subnet after deleting an Azure SQL Managed Instance

Applies to: Azure SQL Managed Instance

This article provides guidelines on how to manually delete a subnet after deleting the last Azure SQL Managed Instance residing in it. You can delete a virtual network subnet only if there are no resources in the subnet.

SQL Managed Instances are deployed into virtual clusters. Each virtual cluster is associated with a subnet and automatically deployed together with first instance creation. In the same way, a virtual cluster is automatically removed together with last instance deletion leaving the subnet empty and ready for removal.

Important

There is no need for any manual action on the virtual cluster in order to release the subnet. Once the last virtual cluster is deleted, you can go and delete the subnet.

There are rare circumstances in which create operation can fail and result with deployed empty virtual cluster. Additionally, as instance creation can be canceled, it is possible for a virtual cluster to be deployed with instances residing inside, in a failed to deploy state. Virtual cluster removal will automatically be initiated in these situations and removed in the background.

Important

  • There are no charges for keeping an empty virtual cluster or instances that have failed to create.
  • Deletion of a virtual cluster is a long-running operation lasting for about 1.5 hours (see SQL Managed Instance management operations for up-to-date virtual cluster delete time). The virtual cluster will still be visible in the portal until this process is completed.
  • Only one delete operation can be run on the virtual cluster. All subsequent customer-initiated delete requests will result with an error as delete operation is already in progress.

Delete a virtual cluster from the Azure portal [DEPRECATED]

Important

Starting September 1, 2021. all virtual clusters are automatically removed when last instance in the cluster has been deleted. Manual removal of the virtual cluster is not required anymore.

To delete a virtual cluster by using the Azure portal, search for the virtual cluster resources.

Screenshot of the Azure portal, with search box highlighted

After you locate the virtual cluster you want to delete, select this resource, and select Delete. You're prompted to confirm the virtual cluster deletion.

Screenshot of the Azure portal Virtual clusters dashboard, with the Delete option highlighted

Azure portal notifications will show you a confirmation that the request to delete the virtual cluster has been successfully submitted. The deletion operation itself will last for about 1.5 hours, during which the virtual cluster will still be visible in portal. Once the process is completed, the virtual cluster will no longer be visible and the subnet associated with it will be released for reuse.

Tip

If there are no SQL Managed Instances shown in the virtual cluster, and you are unable to delete the virtual cluster, ensure that you do not have an ongoing instance deployment in progress. This includes started and canceled deployments that are still in progress. This is because these operations will still use the virtual cluster, locking it from deletion. Review the Deployments tab of the resource group where the instance was deployed to see any deployments in progress. In this case, wait for the deployment to complete, then delete the SQL Managed Instance. The virtual cluster will be synchronously deleted as part of the instance removal.

Delete a virtual cluster by using the API [DEPRECATED]

Important

Starting September 1, 2021. all virtual clusters are automatically removed when last instance in the cluster has been deleted. Manual removal of the virtual cluster is not required anymore.

To delete a virtual cluster through the API, use the URI parameters specified in the virtual clusters delete method.

Next steps