An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
I reproduced this end to end in a clean lab. The link does get released, but not immediately, and not by anything you do in your subscription.
Repro (fresh subscription, North Europe, official quickstart templates)
- Deployed Azure Cloud Shell – VNet and Azure Cloud Shell – VNet storage. Before connecting Cloud Shell:
cloudshellsubnetdelegated toMicrosoft.ContainerInstance/containerGroups, no service association link. - Connected Cloud Shell to the VNet (session IP
10.0.1.x). The subnet now hasacisal:
linkedResourceType : Microsoft.ContainerInstance/containerGroups
allowDelete : true
- Ran
exitand closed Cloud Shell (Day 1, 12:44). Polled every 5 minutes:acisalwas still present after 35 minutes. - The ACI SAL removal returned exactly your error:
DELETE .../subnets/cloudshellsubnet/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default?api-version=2018-10-01
Conflict SubnetInUse
"...is still in use. Please delete all container groups in the subnet and try again.
One sample container group in use is
/subscriptions/<Microsoft subscription>/resourceGroups/cag-westeurope-1/providers/Microsoft.ContainerInstance/containerGroups/ae2prodamcag-1-..."
The resource group is named cag-westeurope-1 even though my VNet is in North Europe, so the name is internal to Cloud Shell and doesn't refer to your region.
- Cloud Shell → Settings → Reset user settings (Day 1, 13:40). Still present after 26 more minutes. The same DELETE still returned
SubnetInUseat 14:14. - Left everything untouched (Relay, storage, VNet all in place, no Cloud Shell sessions). Day 2, 16:37: the same DELETE succeeded (no error), the subnet showed
serviceAssociationLinks: nullandprovisioningState: Succeeded, andaz group deleteremoved the whole resource group cleanly.
So the Microsoft-side container group was cleaned up somewhere between ~30 minutes and ~27 hours after the Cloud Shell user settings were reset. I couldn't pin it down more precisely.
What to do in your case
- Make sure no Cloud Shell session or user setting still points at the VNet. Open Cloud Shell → Settings → Reset user settings, then close it. Do this for every user who configured Cloud Shell on this VNet.
- Retry the SAL removal now, and then once a day:
az rest --method delete --url "https://management.azure.com/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Network/virtualNetworks/<vnet>/subnets/<container-subnet>/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default?api-version=2018-10-01"
No output means success. Then confirm serviceAssociationLinks is null and delete the VNet. That also clears the Failed state and SubnetCannotGetUpdatedWhenParentVnetDeletionWasAttemptedEarlier.
- If it still returns
SubnetInUseafter ~48 hours, the container group isn't being garbage-collected. You can't delete it yourself because it lives in a Microsoft subscription. On a Basic plan, ask a Microsoft moderator in this thread for one-time free technical support, and include the subnet resource ID, the fullSubnetInUsemessage with the container group ID, and the correlation ID.
An orphaned VNet/NSG costs nothing, so there's no cost pressure while you wait.
Recommended teardown order for anyone removing Cloud Shell VNet isolation: reset Cloud Shell user settings for all users → wait until the ACI SAL DELETE succeeds → then delete the VNet / resource group. Deleting the VNet first is what leaves it in the Failed state you're seeing.
References: Deploy Cloud Shell in a virtual network · Cloud Shell virtual network overview