Cannot delete Cognitive Services (AIServices) accounts - 500 InternalServerError

Snehansh Akhaury 0 Reputation points
2026-09-11T07:50:16.6733333+00:00

Hello,

I am unable to delete three Azure Cognitive Services (kind: AIServices) accounts in my subscription. Every attempt to delete them via Azure Portal, Azure CLI, and ARM REST API fails immediately with HTTP 500:

"error": {"code": "InternalServerError", "message": "Encountered internal server error. Please try again."}

Details:

  • Subscription ID: a974d1df-6314-45f6-8d0a-7cb4d9fc4cb6
  • Region: southindia
  • Correlation ID: ffdfce0b-a4dd-4461-a734-f7b04dddae14
  • Response Header: x-ms-failure-cause: service

Stuck Resources:

  1. /subscriptions/a974d1df-6314-45f6-8d0a-7cb4d9fc4cb6/resourceGroups/aiagent-course-rg/providers/Microsoft.CognitiveServices/accounts/coursesa
  2. /subscriptions/a974d1df-6314-45f6-8d0a-7cb4d9fc4cb6/resourceGroups/rg-aca-aiagent/providers/Microsoft.CognitiveServices/accounts/acacoursetest2
  3. /subscriptions/a974d1df-6314-45f6-8d0a-7cb4d9fc4cb6/resourceGroups/aca-scaling-course-rg/providers/Microsoft.CognitiveServices/accounts/acascalingcoursetest

Notes:

  • All child model deployments, Foundry projects, and associated Container App environments have already been completely removed.
  • The parent resource groups are also stuck in "Deleting" state because these accounts cannot be deleted.
  • Please help perform a backend hard-delete/purge on these orphaned accounts and their parent resource groups (aiagent-course-rg, rg-aca-aiagent, aca-scaling-course-rg).
  • Please ensure resource group 'rg-simple-chat-app' is preserved.

Thank you!

Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform

0 comments No comments

1 answer

Sort by: Most helpful
  1. Allan Solomon Mejia 8,420 Reputation points
    2026-09-12T22:57:49.14+00:00

    Hello @Snehansh Akhaury

    Based on the behavior you've described, this doesn't look like a normal Azure Portal or CLI deletion problem.

    The important details are HTTP 500 InternalServerError, and x-ms-failure-cause: service

    The same deletion fails through the Azure Portal, Azure CLI, and the ARM REST API. That points toward Microsoft.CognitiveServices resource provider/backend rather than a client-side issue.

    There are two different operations worth distinguishing here:

    1. Delete an active AI Services/Cognitive Services account

    az cognitiveservices account delete \
      --name <account-name> \
      --resource-group <resource-group>
    

    This is the normal deletion operation for an existing Cognitive Services account.

    2. Purge a soft-deleted account

    Purge only applies after the account has successfully entered the deleted/soft-deleted state:

    az cognitiveservices account list-deleted
    

    and, if the account appears there:

    az cognitiveservices account purge \
      --name <account-name> \
      --resource-group <resource-group> \
      --location southindia
    

    Account purge is specifically for a soft-deleted Cognitive Services account.

    Therefore, don't repeatedly run purge against these resources unless list-deleted confirms they've actually transitioned into the soft-deleted collection.

    One useful diagnostic would be:

    az cognitiveservices account show \
      -g <resource-group> \
      -n <account-name> \
      --query "{name:name,kind:kind,location:location,provisioningState:properties.provisioningState,id:id}"
    

    followed by:

    az cognitiveservices account list-deleted -o table
    

    If the accounts still appear as active ARM resources but every DELETE immediately returns the same service-side HTTP 500, there's probably no customer-side hard-delete command that can bypass that backend condition.

    Also check the resource and resource-group Locks and the resource group's Deployments blade, but a normal lock would generally result in an authorization/lock-related response rather than the service-side InternalServerError you're receiving.

    Microsoft does expose a dedicated REST operation for permanently purging a deleted account:

    DELETE .../providers/Microsoft.CognitiveServices/

    locations/{location}/resourceGroups/{resourceGroup}/

    deletedAccounts/{accountName}

    But again, that's for a resource already in the deleted-account collection; it isn't a force-delete API for an active account whose normal DELETE operation is returning HTTP 500.

    At this point, open an Azure Support request for Azure AI Services / Cognitive Services resource management and ask Microsoft to investigate the resource provider state for these three accounts.

    Provide them privately with:

    • Region: southindia
    • Resource type: Microsoft.CognitiveServices/accounts
    • Kind: AIServices
    • Correlation ID: ffdcef0b-a4dd-4461-a734-f7b04dddae14
    • HTTP status: 500 InternalServerError
    • x-ms-failure-cause: service
    • UTC timestamps of several failed DELETE attempts
    • Full resource IDs of the three affected accounts

    Specifically ask Microsoft to determine whether the accounts have orphaned backend dependencies/state preventing the resource provider from completing DELETE, and whether backend cleanup is required.

    One security note: you've included your subscription ID and full resource IDs in the public Q&A post. Those aren't credentials, but there's generally no benefit to publishing them. Please edit the question and redact the subscription ID and full resource IDs, then provide them privately in the support case.

    Also, clearly state that rg-simple-chat-app must not be touched. Support should target only the three affected Cognitive Services accounts and their specified resource groups.

    References:

    Azure CLI - Cognitive Services account delete/list-deleted/purge

    Azure AI Services REST API - Delete account

    Azure AI Services REST API — Purge deleted account


    Help make this community better for everyone: If this answer helped or resolved your issue, please accept it or upvote it. If not, share more details in a comment so we can continue the discussion and find the right solution. Thank you.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.