Home > Blockchain >  Can't delete resource group from Azure Container App
Can't delete resource group from Azure Container App

Time:09-22

I recently created inside one of my resource groups an Azure Container App (with an environment & the rest) just for learning reasons (at the West Europe region). After I played with that, I decided to delete it. I tried to delete it without any success from the portal.

Looking around in the portal I found out that a new resource group had been created with name MC_braverock-518cbd83-rg_braverock-518cbd83_westeurope. This resource group was never generated by me. It appears that inside it there are a public IP address, a NSG & 2 Kubernetes Load Balancers.

I tried then to delete that auto-generated (somehow) resource group but again with no success. I literarily can't even touch it. I tried to delete all resources one by one. Nothing again. I even issued the command az group delete --resource-group "MC_braverock-518cbd83-rg_braverock-518cbd83_westeurope" from inside the Azure Cloud Shell and it seems that the cli gets stuck in Running.... When I had issued the command from the portal it was still running for a whole hour. So, obviously something is going wrong.

I visited the page enter image description here

CodePudding user response:

To delete the resources and the resource group, you can try using Resource Explorer (azure.com) portal as there might be some dependencies to delete the resource group/resources.

You can try deleting the resources like below:

enter image description here

  • Expand Providers -> Microsoft.Network -> networkSecurityGroups -> Select your NSG -> Action(POST,DELETE) -> Delete

enter image description here

In my environment testnsg networkSecurityGroup deleted successfully in the Azure Portal.

  • You can try deleting the required Azure Resources by following the same process. If still, you are not able to delete the Azure resource Group try checking the child resources associated to that resource group.

I tried to reproduce the same in my environment and got the same error like below:

az network lb delete -g ResourceGroupName  -n LoadBalancerName

enter image description here

The error "LoadBalancerUseByVirtualMachineScaleSet" usually occurs if backendpool is being used by any other resource.

To resolve the error, try executing below commands in CloudShell like below:

  • Delete the load balancer associated with the VMSS:
az vmss update --resource-group ResourceGroupName1 --name VmssName --remove virtualMachineProfile.networkProfile.networkInterfaceConfigurations[0].ipConfigurations[0].loadBalancerBackendAddressPools 0

enter image description here

  • Update the VMSS instance:
az vmss update-instances --instance-ids "*" -n VmssName -g ResourceGroupName1

enter image description here

Now, delete load balancer and it will be deleted successfully like below:

az network lb delete -g ResourceGroupName -n LoadBalancerName

enter image description here

Reference:

Update or delete an existing load balancer used by virtual machine scale sets - Azure Load Balancer

CodePudding user response:

This is a side artifact of Container app managedEnvironment resource. You need to first delete the environment in order to get artifacts to get automatically removed.

  • Related