Batch account pool deletion stuck in resizing
have one batch account with multiple batch pool. trying to delete one of the batch pool but it get stuck in resizing from almost 3 days now. looking for a solution to delete that pool completely
thanks
-
Ankit Yadav 14,455 Reputation points • Microsoft External Staff • Moderator
Hello Rahul,
Just checking in if you are still blocked with Azure Batch account deletion or if it's deleted successfully for you.
Sign in to comment
2 answers
-
Ankit Yadav 14,455 Reputation points • Microsoft External Staff • Moderator
Hey Rahul,
it looks like your pool deletion is stuck in “Resizing” because the Batch service can’t finish tearing down all of the underlying resources. This usually happens when there are resource locks or leftover networking dependencies that block the deletion. Here’s what you can try:
- Check Activity Logs
- Go to your Batch account in the Azure portal → Activity log.
- Look for errors like “ScopeLocked” or messages about load balancers or NSGs being locked or in use.
- Remove Resource Locks
- If you see a “ScopeLocked” error on the resource group or the Batch account itself, remove that lock: • Portal: Resource group → Locks → Delete the lock • Or use Azure CLI/PowerShell to remove the lock.
- If you had a lock on extra networking resources (for example, the Azure-created load balancer), remove it from the virtual network’s resource group.
- Disassociate Batch-Created Networking Dependencies
- If your pool was in a virtual network, Azure automatically created a load balancer, public IP, and NSG.
- If the NSG is still attached to a subnet or another resource, go disassociate it: Virtual network → Subnets → Network security group → None.
- Once disassociated, the Batch service should be able to delete the NSG and finish removing the pool within ~20 minutes.
- Wait and Verify
- After unlocking and disassociating, wait about 20–30 minutes and refresh the portal.
- The pool should move from “Deleting” → “Deleted.”
If none of the above solves it, here are a few follow-up questions so we can drill down further:
• What exact error message do you see in the Activity log when the delete hangs?
• Do you have any locks on the resource group or the Batch account?
• Is the pool connected to a virtual network?
• Have you checked for locks on the load balancer or NSG in that VNet’s resource group?
• Did you try removing/disassociating the NSG from any subnets?
Hope this helps you get that pool fully deleted!
Reference list
- Troubleshoot pool stuck in resizing mode after deletion: https://learn.microsoft.com/en-us/troubleshoot/azure/general/azure-batch-pool-deletion-failure#scenario-2-batch-pool-is-stuck-in-resizing-mode-after-an-attempted-pool-deletion
- Remove resource lock on resource group: https://learn.microsoft.com/en-us/troubleshoot/azure/general/azure-batch-pool-deletion-failure#cause-1a-batch-account-resource-group-is-locked
- Remove resource lock on batch account: https://learn.microsoft.com/en-us/troubleshoot/azure/general/azure-batch-pool-deletion-failure#cause-1b-batch-account-is-locked
- Remove locks on extra networking resources: https://learn.microsoft.com/en-us/troubleshoot/azure/general/azure-batch-pool-deletion-failure#symptom-2a
- Disassociate batch-created dependencies (like NSG): https://learn.microsoft.com/en-us/azure/virtual-network/manage-network-security-group#associate-or-dissociate-a-network-security-group-to-or-from-a-subnet-or-network-interface
Note: This content was drafted with the help of an AI system. Please verify the information before relying on it for decision-making.
- Check Activity Logs
-
AI answer
Use the following steps to unblock and complete deletion of the stuck Batch pool.
- Confirm the pool is in
deleting/resizing state- Use Azure Portal or CLI to verify the pool state and that it has been stuck for a long time. Batch sets
poolStatetodeletingand resizes nodes to zero before removing the pool object. - If deletion is taking longer than expected, Batch keeps retrying, but certain issues require manual fixes.
- Use Azure Portal or CLI to verify the pool state and that it has been stuck for a long time. Batch sets
- Check for resource locks on the Batch account and its resource group
- In the Azure portal, go to the resource group that contains the Batch account.
- Check Locks on the resource group.
- If there is a lock (for example,
DeleteorReadOnly), remove it. - This resolves Cause 1a where the Batch account’s resource group is locked and prevents delete operations.
- If there is a lock (for example,
- Check Locks on the resource group.
- Then open the Batch account resource.
- Check Locks on the Batch account itself.
- If present, remove the lock.
- This resolves Cause 1b where the Batch account is locked.
- Check Locks on the Batch account itself.
- After removing locks, wait ~20 minutes and re-check the pool; if still present, retry deletion.
- In the Azure portal, go to the resource group that contains the Batch account.
- If the pool uses a virtual network, check locks and dependencies on Batch-created network resources
- When a pool is created in a virtual network, Batch automatically creates:
- Network Security Group (NSG)
- Public IP address
- Load balancer
- Deleting or resizing the pool to zero requires Batch to delete these resources.
- Go to the resource group that contains the virtual network used by the pool.
- Check Locks on that resource group.
- If there is a lock, remove it.
- This resolves Cause 2a where extra networking resources in the resource group are locked and block deletion of the Batch-created load balancer.
- After removing locks, wait ~20 minutes for Batch to complete deletion.
- In the same resource group, locate the Batch-created NSG, public IP, and load balancer (names typically include
azurebatch-cloudserviceloadbalancerorazurebatch-cloudservicenetworksecuritygroup). - If the NSG is associated with other subnets or NICs outside the Batch pool, or if other resources depend on the Batch-created IP or load balancer, Batch cannot delete them and the pool deletion will hang.
- For example, an activity log entry like:
-
Network security group ... cannot be deleted because it is in use by ... virtualNetworks/<vnet>/subnets/<subnet> - indicates Cause 2b.
-
- For example, an activity log entry like:
- Fix by disassociating these dependencies:
- Disassociate the NSG from any subnet or NIC that is not part of the Batch pool (see associate or dissociate a network security group to or from a subnet or network interface).
- After removing dependencies, wait ~20 minutes; Batch should finish deleting the pool and its network resources.
- When a pool is created in a virtual network, Batch automatically creates:
- Retry or monitor deletion via CLI/SDK
- If needed, explicitly request deletion again:
- Azure CLI:
az batch pool delete --pool-id <pool-id> - Or via Python SDK
PoolOperations.delete(pool_id=...).
- Azure CLI:
- Note: If the pool is already in
deletingstate, any further Update/Patch/Delete calls will fail with HTTP 409PoolBeingDeleteduntil the underlying issues (locks/dependencies) are resolved.
- If needed, explicitly request deletion again:
- If deletion still does not complete
- After removing all locks and external dependencies and waiting sufficient time, if the pool remains stuck, check for broader conditions mentioned for pool deletion failures:
- Ensure
Microsoft.Batchresource provider is still registered in the subscription. - For user subscription mode accounts, ensure
Microsoft Azure Batchstill has Contributor or Owner role on the subscription that contains the pool.
- Ensure
- After removing all locks and external dependencies and waiting sufficient time, if the pool remains stuck, check for broader conditions mentioned for pool deletion failures:
Once all locks and external dependencies are cleared and Batch has required permissions, the stuck pool should automatically complete deletion within about 20 minutes; if not, re-issuing the delete request after fixes should succeed.
References:
AI-generated content may be incorrect. Read our transparency notes for more information. - Confirm the pool is in
