Hi,
I had a test environment where I deployed my own Kubernetes cluster, connected it with Azure Arc, deployed the AppService extension and created an AppService on it. Everything worked nicely.
When I finished my work, I simply deleted the resource group and my "App Service Kubernetes Environment" resource stuck there. The error message says: "Failed to delete Kubernetes environment <NAME>: The specified kube environment <NAME> cannot be deleted because it still contains resources."
Of course there are not AppServices attached to this resource and the K8s cluster's extension is also detached. No Apps and neither no App Service plans attached to the resource. So it is empty.
In the JSON, the extededLocation still refers to the custom location what I created but that is already deleted when I triggered the whole resource group deletion.
I tried to delete the resource via Azure CLI (az resource delete) as well and I got the same error message.
This happened with me second time. First time I rebuilt the components and I deleted manually in the right order. So that will be the workaround here as well.
I guess this is a bug as it didn't keep the dependency order during deletion. I wanted to report this it via the support channel but MS asks money for that hence I drop it here. Maybe a relevant person can translate it to the right place :)