Cannot delete container app environment

Samuel Bradshaw 30 Reputation points
2024-04-25T16:16:00.07+00:00

I am unable to delete a container app environment from azure. When I try to delete it, I get the message "The specified environment xxxxxxxxx cannot be deleted because it still contains 1 ContainerApps".

However, when I go to the Apps tab on the container app environment, I cannot see any container apps listed.

Although I cannot see any container apps listed under my container app environment, it seems that my container app environment has created a separate resource group that does contain a container app. I cannot delete this either as it has a read-only Deny assignment added that prevents me from being able to delete it.

In summary, I have a container app environment that I cannot delete as it is still linked to a container app which I also cannot delete.

This seems to be a bug in Azure. Screenshot 2024-04-25 at 17.14.36

Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
444 questions
{count} votes

2 answers

Sort by: Most helpful
  1. MayankBargali-MSFT 70,536 Reputation points
    2024-04-26T10:12:26.63+00:00

    @Samuel Bradshaw Thanks for reaching out and apology for the inconvenience due to this issue. Can you retry the operation again and confirm if you are still facing the issue.

    Delete is the async operation and sometimes it may take time to get it completed.

    In case if you still not able to delete then please let me know so I can assist you further.

    0 comments No comments

  2. Rodrigo Dos Santos Barbosa 25 Reputation points
    2024-07-19T20:32:54.6033333+00:00

    Hello @Samuel Bradshaw !

    The builder is a different resource from the app container. When this happens, you must first remove the builder and then remove the app environment container. To check if you have a pending builder, list the resources associated with your environment with the following command:

    az resource list --namespace Microsoft.App --resource-type builders

    You will probably receive a response with a resource like Microsoft.App/builders. To remove it, run the following command replacing <builder-resource-id> with the builder id that you found in the query:

    az rest --method delete --url <builder-resource-id>?api-version=2023-08-01-preview

    The command will run in the background. Repeat the query until the builder resource stops returning. When the return is empty, proceed with deleting the app environment container:

    az containerapp env delete -n MyContainerappEnvironment -g MyResourceGroup

    And now you should be able to delete without any problems via command line or the portal. Be patient, as this command takes time to complete.

    0 comments No comments

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.