Resource group deletion failed due to an ongoing operation on storage account 'prodexamplestorageacc'. A current task requires exclusive access, blocking deletion. Check audit logs for details.

L kondareddy 0 Reputation points
2025-02-22T13:33:59.2133333+00:00

Delete resource group example-resources-prod failed

Failed to delete resource group example-resources-prod: Deletion of resource group 'example-resources-prod' failed as resources with identifiers 'Microsoft.Storage/storageAccounts/prodexamplestorageacc' could not be deleted. The provisioning state of the resource group will be rolled back. The tracking Id is '00000000000000'. Please check audit logs for more details. (Code: ResourceGroupDeletionBlocked) An operation is currently performing on this storage account that requires exclusive access. (Code: StorageAccountOperationInProgress, Target: /subscriptions/000000000000000000/resourceGroups/example-resources-prod/providers/Microsoft.Storage/storageAccounts/prodexamplestorage

i had done all trouble shooting which is copilot suggested ,the problem is while deleting resource groups which are created by terraform infra 3storage account is 1 is general for the back end for store the all terrraform state file s,remaining 2 are one is prod,another one is dev i a created in prod i am changed terraform code itself "LRS" to "GRS" then next because of no time i did not destroy all resources with terraform destroycommand ,i am tried manulla with portal inter face direclty by selecting resource group main which used to backend first then dev also deleted which are change LRS TO GRS one storage which is had resoure group not able to do above on eis error

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,428 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Keshavulu Dasari 4,280 Reputation points Microsoft External Staff
    2025-02-22T18:27:27.9566667+00:00

    Hi L kondareddy,

    I Understand the issue involving Terraform and Azure resource group deletions. I Suggest few steps you can take to resolve this,

    Ensure that there are no ongoing operations on the storage account prodexamplestorageacc. You can do this by checking the Azure Activity Log for any active tasks.
    Sometimes, Terraform's dependency tree can prevent deletion if resources are still present. You can modify your Terraform provider configuration to allow deletion of resource groups even if they contain resources:

    provider "azurerm" {
      features {
        resource_group {
          prevent_deletion_if_contains_resources = false
        }
      }
    }
    

    This setting will allow Terraform to delete the resource group regardless of the resources it contains

    If Terraform is still unable to delete the resource group, you might need to manually delete the resources within the group using the Azure portal or CLI before attempting to delete the resource group again.

    Ensure that your Terraform state file is up-to-date and not corrupted. You can use the terraform state rm command to remove specific resources from the state file if necessary

    After ensuring no ongoing operations and updating your Terraform configuration, try deleting the resource group again.

    For more information:
    https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/delete-resource-group?tabs=azure-powershell

    https://github.com/hashicorp/terraform-provider-azurerm/issues/16155

    I hope this information helps! Let us know if you have any further questions. We will be glad to assist you further.

    0 comments No comments

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.