Hi @Shubham,
Thanks for contacting Microsoft Q&A platform.
The issue you are facing might happen in the following scenarios.
Cause 1: The batch service can't delete the load balancer, as shown by the following activity log entry:
The scope '/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/loadBalancers/<guid>-azurebatch-cloudserviceloadbalancer' cannot perform delete operation because following scope(s) are locked: '/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>. Please remove the lock and try again.
Fix: Remove resource locks on the extra networking resources
Remove the resource lock from the resource group that contains the virtual network. The pool should then be fully deleted after about 20 minutes.
Cause 2:
The batch service can't delete the network security group (NSG), as shown by the following activity log entry:
Network security group /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/networkSecurityGroups/<guid>-azurebatch-cloudservicenetworksecuritygroup cannot be deleted because it is in use by the following resources: /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/virtualNetworks/<virtual-network-name>/subnets/<subnet-name>. In order to delete the Network security group, remove the association with the resource(s). To learn how to do this, see Delete a network security group.
Fix: Disassociate the resource dependencies
Remove the batch pool dependencies on the resources that are used outside the batch pool. For this example, you would disassociate the NSG from the subnet. After you make this change, the batch service finishes deleting the batch pool after about 20 minutes.
Hope this helps you.