[ResourceManager] Unable to delete locks
See original GitHub issueaz lock delete --name $LOCKNAME
does not return any value and seems to have no impact
My specific use case: I am unable to delete or update a lock associate with a storage account which itself was associated with a function app. I want to delete the storage account after having deleted a function app via CLI.
There appears to be no workaround since the Portal no longer gives me access to the function settings (and locks).
Steps to reproduce:
az appservice web delete --name shortlinkservice --resource-group shortlinkservice-group
az storage account delete --name function92f1a43683ee --resource-group shortlinkservice-group
Are you sure you want to perform this operation? (y/n): y
The scope '/subscriptions/203c6e23-7c41-47de-8f9f-2ad1807ae229/resourceGroups/shortlinkservice-group/providers/Microsoft.Storage/storageAccounts/function92f1a43683ee' cannot perform delete operation because following scope(s) are locked: '/subscriptions/203c6e23-7c41-47de-8f9f-2ad1807ae229/resourcegroups/shortlinkservice-group/providers/Microsoft.Storage/storageAccounts/function92f1a43683ee'. Please remove the lock and try again.
az lock list
[
{
"id": "/subscriptions/203c6e23-7c41-47de-8f9f-2ad1807ae229/resourcegroups/shortlinkservice-group/providers/Microsoft.Storage/storageAccounts/function92f1a43683ee/providers/Microsoft.Authorization/locks/function92f1a43683ee",
"level": "CanNotDelete",
"name": "function92f1a43683ee",
"notes": "One or more function apps were linked to this storage account. You can see all the function apps linked to the account under 'files' or 'shares'.",
"type": "Microsoft.Authorization/locks"
}
]
az lock delete --name function92f1a43683ee
(no return value or error)
az lock list
[
{
"id": "/subscriptions/203c6e23-7c41-47de-8f9f-2ad1807ae229/resourcegroups/shortlinkservice-group/providers/Microsoft.Storage/storageAccounts/function92f1a43683ee/providers/Microsoft.Authorization/locks/function92f1a43683ee",
"level": "CanNotDelete",
"name": "function92f1a43683ee",
"notes": "One or more function apps were linked to this storage account. You can see all the function apps linked to the account under 'files' or 'shares'.",
"type": "Microsoft.Authorization/locks"
}
]
az lock update --name function92f1a436833ee
The lock 'function92f1a436833ee' could not be found.
Stuck.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Protect your Azure resources with a lock - Microsoft Learn
A cannot-delete lock on a resource group prevents Azure Resource Manager from automatically deleting deployments in the history.
Read more >Protecting Azure Resources with Resource Manager Locks
Resource Manager Locks provide a way for administrators to lock down Azure resources to prevent deletion or changing of a resource.
Read more >DEMO Azure Locks on Resource Group - YouTube
A cannot - delete lock on a resource group prevents Azure Resource Manager from automatically deleting deployments in the history.
Read more >Cannot perform delete operation because the scope is locked ...
How to remove Azure Resource lock so you can delete the Azure resource? ... Open the resource you want to delete and select...
Read more >Learn using Resource Locks - Testprep Training Tutorials
A cannot-delete lock on a resource group prevents Azure Resource Manager from automatically deleting deployments in the history. A cannot-delete lock on the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had similar problems. However I had to include the resource type, name, resource group and resource name flags to remove the lock.
@berndverst, since the lock is on the storage account, even though you can’t access the deleted function app, you should be able to access and delete the lock on the storage account in the portal.