Can't delete azure object

Jadams 0 Reputation points
2026-10-08T14:22:06.8933333+00:00

Trying to remove an old resource group from azure but it has a lock on it. If I try to delete the lock i get: Lock Deletion Failure. The lock named xxxx was unable to be deleted for the following reasons: %s. The the log also has: The Resource 'Microsoft.Storage/storageAccounts/migrate7088alsa366599' under resource group 'xxxx' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix

Azure Storage
Azure Storage

Globally unique resources that provide access to data management services and serve as the parent namespace for the services.

0 comments No comments

1 answer

Sort by: Most helpful
  1. AI answer

    2026-10-08T14:22:25.95+00:00

    This usually means the resource group is locked, and the lock may be inherited, system-owned, or tied to a managed application.

    1. Check whether the lock is on the resource group itself or inherited from a parent scope.
      • A lock applied at a parent scope is inherited by resources in that scope.
      • If a Delete lock exists on any resource in the group, deleting the resource group is blocked.
    2. Verify whether this is a managed application scenario.
      • Some services create a locked infrastructure resource group that is owned by a system application.
      • In that case, the lock cannot be deleted directly.
      • The correct action is to delete the parent service, which then deletes the managed resource group.
    3. If the lock is a normal management lock and permissions are sufficient, remove it from the correct scope.
      • To create or delete management locks, access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* is required.
      • Owner and User Access Administrator have the required access.
    4. In Azure portal, inspect the lock directly:
      • Open the resource group or affected resource.
      • Go to Settings > Locks.
      • Look for a Delete lock (CanNotDelete).
      • If it is removable, use the ellipsis menu and select Delete.
    5. In Azure CLI, list locks and remove the exact lock by ID:
         az group lock list --output table
      
      If the lock exists and is removable, delete it by ID:
         lockid=$(az lock show --resource-group lockedRG --name deleteLock --output tsv --query id)
         az lock delete --ids $lockid
      
    6. If deletion still fails with resource-not-found for the storage account, check whether the lock references a resource that no longer exists.
      • That can happen when deletion is blocked by service-managed or inherited locks.
      • If the resource group is part of a managed application, delete the parent service instead of trying to delete the lock directly.
    7. Also confirm the resource group delete prerequisites.
      • Deleting a resource group requires the delete action for Microsoft.Resources/subscriptions/resourceGroups.
      • Deletion can also fail because of locks or because resources are connected to resources in other resource groups.

    Important: deleting a resource group removes the group and all associated resources.


    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer 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.