Error deleting subnet serviceAssociationLinks AppServiceLink related to Wordpress portal

LA 20 Reputation points
2023-01-16T06:26:50.58+00:00

Hello,

I am writing due to our problem with being unable to delete VNet due to serviceAssociationLinks/AppServiceLink

The user has created a WordPress resource, which creates Vnet, Database, and ASP resources.

Afterward, the subscription was canceled which by default should delete all inactive resources. However, every resource was deleted except Vnet which points to deleted ASP resources. We have tried to recreate WordPress, however, we couldn't point old Vnet to a new ASP resource, because it is already bound to the old one.

we have also tried deleting Vnet using CLI below, however unsuccessfully:

[string]$ResourceGroupName = 'ResourceGroup'
[string]$VirtualNetworkName = 'Vnet name'
[string]$SubnetName = 'Subnet'
$CurrentAzureContext = Get-AzContext
$AzureRmProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile
$ProfileClient = New-Object Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient($AzureRmProfile)
$Token = $ProfileClient.AcquireAccessToken($CurrentAzureContext.Tenant.TenantId)
[string]$AccessToken = $Token.AccessToken
[string]$ManagementEp = $CurrentAzureContext.Environment.ResourceManagerUrl
[string]$NetworkProfileName = (Get-AzNetworkProfile -ResourceGroupName $ResourceGroupName).Name
[string]$Uri1 = "$($ManagementEp)subscriptions/$($CurrentAzureContext.Subscription.Id)/resourceGroups/$ResourceGroupName/providers/Microsoft.Network/virtualNetworks/$VirtualNetworkName/subnets/$SubnetName/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default?api-version=2018-10-01"
[string]$Uri2 = "$($ManagementEp)subscriptions/$($CurrentAzureContext.Subscription.Id)/resourceGroups/$ResourceGroupName/providers/Microsoft.Network/networkProfiles/$($NetworkProfileName)?api-version=2020-05-01"
Invoke-RestMethod -Method Delete -Uri $Uri1 -Headers @{"Authorization" = ("Bearer " + $AccessToken) }
Invoke-RestMethod -Method Delete -Uri $Uri2 -Headers @{"Authorization" = ("Bearer " + $AccessToken) }
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,773 questions
Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

Accepted answer
  1. KapilAnanth-MSFT 49,611 Reputation points Microsoft Employee Moderator
    2023-01-19T05:46:40.4866667+00:00

    @LA

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    I understand that you are unable to delete your VNet because of a Service Association Link (SAL).

    I suggested we create a service request for this and request our Engineer to delete the SAL from the backend.

    Post which, you were able to delete the VNet successfully.

    I hope we were able to resolve your issue and provide a timely solution.

    Cheers,

    Kapil.


    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Manu Philip 20,206 Reputation points MVP Volunteer Moderator
    2023-01-16T06:51:21.2333333+00:00

    Sometimes, the resources can be stuck due to the procedural way of deleting the resources. In those occasions, you can try to send a delete command from the resources page: [https://resources.azure.com/

    Login the page and locate the VNET you are looking for to be deleted in similar way as below:

    User's image

    You can POST the Delete command from the right side as shown below:

    User's image

    If that doesn't help, try a force update of the resource from this page and try a delete again from portal or cli


    --please don't forget to upvote and Accept as answer if the reply is helpful--

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.