Can't delete vnet

(Chip) Ronald Olsen 20 Reputation points

Failed to delete virtual network 'vnXX-deXX-deXisiontXXX'. Error: Subnet app-01 is in use by /subscriptions/c0d935XX-9aXX-49XX-a1X-eae99b68XXXX/resourceGroups/rg-vneX-dXXX-decisiontXXX/providers/Microsoft.Network/virtXXXNetwoXXX/vnet-deXX-decisiontXXX/subnets/app-01/serviceAssociationLinks/AppServiceLXXX

Link and all associated setup was removed some time ago. VNet remains.

  1. Golla Venkata Pavani 6,085 Reputation points Microsoft External Staff Moderator

    Hi @(Chip) Ronald Olsen

    Thank you for reaching us regarding the issue.

    We have begun looking into it and will share our suggestions with you as soon as possible. If you have any additional details or concerns in the meantime, please let us know. We appreciate your patience while we work on this.


Sign in to comment

Answer accepted by question author

TP 157.5K Reputation points Volunteer Moderator

Hi,

Please run command similar to below in Azure Cloud Shell (Bash mode) to purge unused Service Association Link (SAL). Substitute SubscriptionId, Location, SubnetId. Subnet Id can be found by navigating to your subnet in portal and clicking the Copy icon next to Subnet ID

az rest --method POST \
 --uri "/subscriptions/<SubscriptionId>/providers/Microsoft.Web/locations/<Location>/purgeUnusedVirtualNetworkIntegration?api-version=2024-04-01" \
 --body "{'subnetResourceId': '<SubnetId>'}"

You should see output similar to below:

👁 User's image

Once you have completed the above, try the delete again.

Please click Accept Answer and upvote if the above was helpful.

Thanks.

-TP

0 comments No comments

Sign in to comment

1 additional answer

  1. Golla Venkata Pavani 6,085 Reputation points Microsoft External Staff Moderator

    Hii @(Chip) Ronald Olsen

    From the backend investigation, we found that SAL not orphaned, subnet apX-0X in VNet vneX-deXX-decXsiontXXX is actively occupied by service app-decisiontree-poc (409 Conflict, ExtendedCode 55914).

    Remediation steps: You must first disconnect VNET integration from the active app before the SAL can be released:

    1. Disconnect VNET Integration from the active app:
      • Portal: Navigate to App Service apX-deXXsiontXXX-pXX > Networking > VNet Integration > Disconnect
      • CLI: az webapp vnet-integration remove --name apX-deXXsiontXXX-pXX --resource-group <app-resource-group>
    2. If the app is no longer needed, delete it entirely:
      • az webapp delete --name apX-deXXsiontXXX-pXX --resource-group <app-resource-group>
    3. If the SAL persists after disconnecting, use the self-serve purge API:
       az rest --method POST \
       --uri "/subscriptions/c0d93XXX-9aba-49XX-a1XX-eae99b682XXX/providers/Microsoft.Web/locations/eastus2/purgeUnusedVirtualNetworkIntegration?api-version=2024-04-01" \
       --body '{"subnetResourceId": "/subscriptions/c0d93XXX-9aba-4930-a1XX-eae99b68XXXX/resourceGroups/rg-vnet-deXX-decisiontXXX/providers/Microsoft.Network/virtualNetworks/vneX-deXX-decXsiontXXX/subnets/app-XX"}'
      
      Kindly let us know if the above helps or you need further assistance on this issue.   Please "accept" if the information helped you. This will help us and others in the community as well.
    1. Golla Venkata Pavani 6,085 Reputation points Microsoft External Staff Moderator

      Hii @(Chip) Ronald Olsen

      Thanks for your response. If you found my assistance is helpful, Please "accept" the answer. It will be helpful for other community members as well.


    Sign in to comment
Sign in to answer

Your answer