I have created a lock of type CanNotDelete on a storage account in Azure. The lock works; I cannot delete the storage account as long as the lock exists. I can get the name and ID of the lock by doing this:
az lock list --resource-group "my-resource-group-name
Now I try to delete the lock from the command line like this:
az lock delete --resource-group "my-resource-group-name --name "name-of-my-lock"
This produces no output (no error message nor confirmation) and does nothing. The lock is still there.
If I add the --debug and --verbose flags to the delete command, I can see that the delete request returns HTTP 204. Still does nothing, though.
My user account has Owner rights. I can delete the lock via the Azure browser-based GUI (logged in as the same user). That works fine. But the command line does not work.
You can try to delete the lock by specifying the lock id. For example, when I do
az lock list --resource-group "my-resource-group-name"I get the following result:
I can then delete this lock using the following command: