Can't do operations or the container group is in a bad state

This article discusses how to resolve a scenario in Microsoft Azure Container Instances in which you can't do container group operations or the container group is in a bad state.

Symptoms

You encounter one or more of the following problems:

  • You try to delete a container group, but the attempt causes an internal server error.

  • You try to run the az container show command in Azure CLI, but the command fails because of an internal server error.

  • In the Azure portal, you can view the container group resource, but you can't do any operations on it.

  • The container group remains in a bad state (such as Stopped or Failed).

Cause

The managed identity of the container group was deleted before an attempt was made to delete the associated container group. This scenario can occur if you try to do this order of deletions manually. It can also occur if you have a regularly scheduled script (such as a nightly script run) that deletes all the resources within a development resource group, including all managed identities and container groups. The script doesn't delete the resources in the correct order: It first deletes the managed identity that's necessary to authenticate the container group, and then it tries to delete the container group itself.

Solution 1: Delete the container group before you delete the managed identity

Delete the container group first, wait for the deletion operation to finish, and then delete the managed identity.

Solution 2: Open a support ticket to get the container groups out of a bad state

If you have any container groups that remain in a bad state because you first deleted the managed identities that are required for container group authentication, open a support ticket. Microsoft Support can stop the affected container groups and help you work through the other necessary steps to fix your container group setup.

More information

Contact us for help

If you have questions or need help, create a support request, or ask Azure community support. You can also submit product feedback to Azure feedback community.