Through the ARM REST API, I want to read a resource (an NSG) modify it and then write it back. I want the last step (writing it back) to fail if something came along and modified the resource in between my read and my write operation. Is that possible? I see there is an ETAG property when I do a GET, perhaps there is some way to utilize it to make the write fail if the resource is modified?
1 Answers
As I known, Azure Table Storage has the ETag
in ITableEntity
which is used for optimistic concurrency during updates. While the Azure REST API Network Security Groups about etag
:
A unique read-only string that changes whenever the resource is updated.
I have tried to leverage Azure Portal and resources.azure.com to simulate the concurrent update operations on my NSG, and I found that there is no concurrency control on the update operation, the configurations would be overrided by the later request.
Per my understanding, there is no build-in feature for you to handle optimistic concurrency. For NSG, I assumed that you would not frequently modify it. So, I think you could try to limit the permission for a few people to update your NSG, or you could build your custom REST API for updating NSG, and get the latest NSG info, then compare the etag
with your prior etag
to determine that whether the NSG is modified before you update it. Also, you could add your feedback here.