Batch account stuck in deleting state

Erik Heeren 60 Reputation points
2025-10-20T08:33:54.5233333+00:00

Hi,

We've got another batch account stuck in deleting state. (see also my previous request ; I wonder if it's the same issue).

In this case, I provisioned the batch account with a pool with one node through terraform and about half an hour later tried to delete it again through terraform. The node was stuck in LEAVINGPOOL for more than a day before getting cleaned up, possibly because I clicked the "stop" button in the portal. I don't know if it's actually deleted or just not being shown any more, because navigating to the pools feature of the account in the portal leads me to a "not found" error page.

While the end goal is to get the batch account deleted, I would very much like to know what is going wrong here and how I can avoid getting into this state again, because "just create a new subscription" is not a workable solution in the long term.

Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
{count} votes

Answer accepted by question author
  1. Himanshu Shekhar 1,780 Reputation points Microsoft External Staff Moderator
    2025-10-20T08:57:40.8666667+00:00

    Hello @Erik Heeren

    Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.

    Based on issue we can suggest details below:

    Please restore the permissions that were previously removed from the Batch service's service principal related to the VMSS operations. The Deployment

    Manager requires the Microsoft.Compute/virtualMachineScaleSets/delete permission to proceed with VMSS deletion.

    Additionally, please ensure the Batch service principal has sufficient permissions for creation, updating, and reading operations on VMSS for successful deployment management.

    The permissions try restoring through Azure role-based access control (RBAC) or through a custom role that includes the required actions on Microsoft.Compute/virtualMachineScaleSets.

    Verify the Batch service principal’s access rights in the subscription/resource group scope where the VMSS are managed.

    Please see carefully on any recent permission changes applied to Batch service and rollback those that impact the DM's ability to manage VMSS.

    Assign built-in roles like Contributor or Virtual Machine Contributor scoped at the subscription or resource group level where VMSS operations occur. Alternatively, please create a custom role with the exact needed permissions for security.

    Assign the role to the Batch service principal (client id '****"') via Azure Portal, CLI, or ARM templates.


0 additional answers

Sort by: Most helpful

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.