“Inconsistent” behaviors when a ReadOnly lock is placed on a Storage Account

%3CLINGO-SUB%20id%3D%22lingo-sub-442270%22%20slang%3D%22en-US%22%3E%E2%80%9CInconsistent%E2%80%9D%20behaviors%20when%20a%20ReadOnly%20lock%20is%20placed%20on%20a%20Storage%20Account%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-442270%22%20slang%3D%22en-US%22%3E%3CP%3EAzure%20resource%20locks%20can%20be%20used%20to%20prevent%20accidentally%20deleting%20or%20modifying%20resources.%20ReadOnly%20lock%20means%20authorized%20users%20can%20read%20a%20resource%2C%20but%20they%20can't%20delete%20or%20update%20the%20resource.%20Resource%20Manager%20locks%20apply%20only%20to%20operations%20that%20happen%20in%20the%20management%20plane.%20The%20locks%20usually%20don't%20restrict%20how%20resources%20perform%20their%20own%20functions%20in%20the%20data%20plane.%3CBR%20%2F%3E%3CBR%20%2F%3EHowever%2C%20applying%20ReadOnly%20can%20lead%20to%20unexpected%20results%20because%20some%20operations%20that%20seem%20like%20read%20operations%20actually%20require%20additional%20actions.%20For%20example%2C%20placing%20a%20ReadOnly%20lock%20on%20a%20storage%20account%20prevents%20all%20users%20from%20listing%20the%20keys.%20(%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Fresource-group-lock-resources).%20But%20depending%20on%20your%20working%20history%20in%20the%20Portal%2C%20your%20experiences%20might%20be%20different.%20If%20you%20just%20listed%20the%20access%20keys%20of%20a%20storage%20account%20before%20placing%20a%20ReadOnly%20lock%20on%20the%20storage%20account%2C%20you%20could%20still%20be%20able%20to%20see%20the%20keys%20for%20a%20while.%20Is%20this%20because%20the%20keys%20are%20cached%3F%20However%2C%20if%20you%20start%20a%20new%20Portal%20session%20after%20placing%20the%20ReadOnly%20lock%2C%20you%20would%20get%20the%20message%20%E2%80%9CThe%20resource%20is%20locked%E2%80%9D.%20That%20means%20you%20can%20list%20the%20access%20keys%20in%20one%20Portal%20session%20while%20getting%20denied%20from%20another%20Portal%20session%20at%20the%20same%20time.%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20will%20also%20see%20different%20behaviors%20when%20accessing%20different%20storage%20account%20services.%20From%20the%20Portal%20session%20where%20you%20can%20still%20list%20the%20keys%2C%20you%20can%20still%20access%20Blob%2C%20File%2C%20Table%20and%20Queue%20services%3B%20and%20you%20can%20upload%20blobs%20to%20blob%20containers.%20However%2C%20in%20the%20new%20Portal%20session%20where%20the%20keys%20are%20no%20longer%20available%2C%20you%20can%E2%80%99t%20access%20File%2C%20Table%20and%20Queue%20services.%20Although%20you%20can%20still%20access%20Blob%20service%2C%20you%20can%E2%80%99t%20access%20blob%20containers.%20Of%20course%2C%20it%20is%20impossible%20to%20upload%20or%20download%20blobs%2Ffiles.%3CBR%20%2F%3E%3CBR%20%2F%3EIt%20seems%20that%20eventually%20the%20%E2%80%9Ccached%E2%80%9D%20keys%20would%20time%20out.%20(I%20don%E2%80%99t%20know%20how%20long%20it%20would%20take.)%20And%20the%20access%20keys%20become%20unavailable%20in%20both%20old%20and%20new%20Portal%20sessions.%20At%20that%20time%2C%20it%20is%20impossible%20to%20upload%2Fdownload%20blobs%2Ffiles%20to%2Ffrom%20the%20storage%20account%20from%20the%20Portal.%20However%2C%20you%20can%20still%20perform%20data%20transfer%20by%20using%20Azure%20Storage%20Explorer%20as%20long%20as%20a%20connection%20had%20been%20established%20before%20the%20ReadOnly%20lock%20is%20placed%2C%20or%20you%20copied%20down%20the%20access%20key%20and%20set%20up%20a%20new%20connection.%3CBR%20%2F%3E%3CBR%20%2F%3EPlacing%20a%20ReadOnly%20lock%20to%20a%20storage%20account%20should%20not%20prevent%20data%20operations%20with%20the%20storage.%20But%20it%20seems%20in%20the%20Portal%20accessing%20different%20storage%20services%20needs%20the%20access%20keys.%20ReadOnly%20lock%20prevents%20getting%20the%20keys%20if%20it%20is%20not%20%E2%80%9Ccached%E2%80%9D%20yet.%20Therefore%2C%20you%20may%20or%20may%20not%20be%20able%20to%20perform%20data%20transfer%20operations%20in%20the%20Portal.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20don%E2%80%99t%20know%20if%20my%20guess%20is%20correct%20or%20not.%20Hope%20someone%20can%20provide%20some%20real%20explanations.%20Thanks%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-442270%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
New Contributor

Azure resource locks can be used to prevent accidentally deleting or modifying resources. ReadOnly lock means authorized users can read a resource, but they can't delete or update the resource. Resource Manager locks apply only to operations that happen in the management plane. The locks usually don't restrict how resources perform their own functions in the data plane.

However, applying ReadOnly can lead to unexpected results because some operations that seem like read operations actually require additional actions. For example, placing a ReadOnly lock on a storage account prevents all users from listing the keys. (//docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-lock-resources). But depending on your working history in the Portal, your experiences might be different. If you just listed the access keys of a storage account before placing a ReadOnly lock on the storage account, you could still be able to see the keys for a while. Is this because the keys are cached? However, if you start a new Portal session after placing the ReadOnly lock, you would get the message “The resource is locked”. That means you can list the access keys in one Portal session while getting denied from another Portal session at the same time.

You will also see different behaviors when accessing different storage account services. From the Portal session where you can still list the keys, you can still access Blob, File, Table and Queue services; and you can upload blobs to blob containers. However, in the new Portal session where the keys are no longer available, you can’t access File, Table and Queue services. Although you can still access Blob service, you can’t access blob containers. Of course, it is impossible to upload or download blobs/files.

It seems that eventually the “cached” keys would time out. (I don’t know how long it would take.) And the access keys become unavailable in both old and new Portal sessions. At that time, it is impossible to upload/download blobs/files to/from the storage account from the Portal. However, you can still perform data transfer by using Azure Storage Explorer as long as a connection had been established before the ReadOnly lock is placed, or you copied down the access key and set up a new connection.

Placing a ReadOnly lock to a storage account should not prevent data operations with the storage. But it seems in the Portal accessing different storage services needs the access keys. ReadOnly lock prevents getting the keys if it is not “cached” yet. Therefore, you may or may not be able to perform data transfer operations in the Portal.

I don’t know if my guess is correct or not. Hope someone can provide some real explanations. Thanks

0 Replies