I can't delete azure container instance, returns internalservererror

Saulo Paiva 0 Reputation points
2025-03-14T16:49:36.14+00:00

(InternalServerError) Encountered an internal server error. The tracking activity id is 'e06070fa-946b-497f-98b7-de91ede6da97', correlation id is '198260a3-1ce1-4b6b-93f1-67454573361f'.

Code: InternalServerError

Message: Encountered an internal server error. The tracking activity id is 'e06070fa-946b-497f-98b7-de91ede6da97', correlation id is '198260a3-1ce1-4b6b-93f1-67454573361f'.

can't delete azure container instance - I could not find resource locks.

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
751 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Rahul Gupta 235 Reputation points Microsoft Employee
    2025-03-18T07:57:32.7633333+00:00

    Hi,

    f you're encountering an InternalServerError while trying to delete an Azure Container Instance (ACI), it could be due to several potential issues. Here are steps you can take to troubleshoot and resolve the problem:

    1. Check ACI Status and Dependencies

    First, verify the current state of the Azure Container Instance and any dependencies it may have (such as storage accounts, networking, or other Azure services). An InternalServerError can sometimes occur if there are unresolved dependencies or issues in the background.

    • Check the ACI's status in the Azure portal.
      • Go to Azure Portal > Container Instances > Select the affected container.
        • Verify if it is running or in another state (e.g., stopped, restarting).

    If the container is running, you may need to stop it first before trying to delete it.

    1. Ensure Proper Permissions

    Make sure that your user account or service principal has the necessary permissions to delete the container. Typically, you need Owner or Contributor permissions for the resource group, or the specific ACI, to perform the deletion.

    • Check your role in the Azure Portal under Access Control (IAM).
    • Ensure that the account you're using has sufficient permissions.
    1. Use Azure CLI to Delete

    Sometimes, the Azure Portal might not respond as expected due to interface issues or API timeouts. You can try deleting the container using Azure CLI instead:

    Open a Command Prompt or Azure Cloud Shell.

    1. Run the following command to delete the container instance:f you're encountering an InternalServerError while trying to delete an Azure Container Instance (ACI), it could be due to several potential issues. Here are steps you can take to troubleshoot and resolve the problem:
      1. Check ACI Status and Dependencies
      First, verify the current state of the Azure Container Instance and any dependencies it may have (such as storage accounts, networking, or other Azure services). An InternalServerError can sometimes occur if there are unresolved dependencies or issues in the background.
      • Check the ACI's status in the Azure portal.
      • Go to Azure Portal > Container Instances > Select the affected container.
      • Verify if it is running or in another state (e.g., stopped, restarting).
      If the container is running, you may need to stop it first before trying to delete it.
      1. Ensure Proper Permissions
      Make sure that your user account or service principal has the necessary permissions to delete the container. Typically, you need Owner or Contributor permissions for the resource group, or the specific ACI, to perform the deletion.
      • Check your role in the Azure Portal under Access Control (IAM).
      • Ensure that the account you're using has sufficient permissions.
      1. Use Azure CLI to Delete
      Sometimes, the Azure Portal might not respond as expected due to interface issues or API timeouts. You can try deleting the container using Azure CLI instead:
      1. Open a Command Prompt or Azure Cloud Shell.
      2. Run the following command to delete the container instance:
      az container delete --resource-group <your-resource-group> --name <your-container-name> --yes
      1. Check Resource Group for Locks
      Ensure that there are no resource locks applied to the container or the resource group, as these can prevent deletion.
      1. Go to Azure Portal > Resource Groups > Select your resource group.
      2. Under Settings, click on Locks.
      3. If there is any lock (e.g., ReadOnly or CanNotDelete), remove it by selecting the lock and choosing Delete.
      4. Check for Active Connections or Networking Issues
      If the container is connected to any external resources (e.g., storage accounts, virtual networks), ensure that those connections are not active or dependent on the container.
      • Review the networking setup and any active connections in the Azure Portal under Networking and Storage.
      • If the container is part of a virtual network, ensure that there are no conflicts or issues that prevent the deletion.
      1. Wait and Retry (or Use Retry-Logic)
      Sometimes, Azure resources experience transient issues, and the deletion might fail due to internal service errors or background processes. It can help to wait a few minutes and retry the deletion.
      1. Check Resource Group for Locks
      Ensure that there are no resource locks applied to the container or the resource group, as these can prevent deletion.
      1. Go to Azure Portal > Resource Groups > Select your resource group.
      2. Under Settings, click on Locks.
      3. If there is any lock (e.g., ReadOnly or CanNotDelete), remove it by selecting the lock and choosing Delete.
      4. Check for Active Connections or Networking Issues
      If the container is connected to any external resources (e.g., storage accounts, virtual networks), ensure that those connections are not active or dependent on the container.
      • Review the networking setup and any active connections in the Azure Portal under Networking and Storage.
      • If the container is part of a virtual network, ensure that there are no conflicts or issues that prevent the deletion.
      1. Wait and Retry (or Use Retry-Logic)
      Sometimes, Azure resources experience transient issues, and the deletion might fail due to internal service errors or background processes. It can help to wait a few minutes and retry the deletion. az container delete --resource-group <your-resource-group> --name <your-container-name> --yes --no-wait
    0 comments No comments

  2. Saulo Paiva 0 Reputation points
    2025-03-18T11:30:52.89+00:00

    Dear Rahul,

    There are no resource blocks and I also let it sit through the weekend. Using Azure CLI returns exact internal server error message.


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.