Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage Account listKey API counts as write operation #6363

Closed
sylr opened this issue Jun 17, 2019 · 20 comments
Closed

Storage Account listKey API counts as write operation #6363

sylr opened this issue Jun 17, 2019 · 20 comments
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Service Attention This issue is responsible by Azure service team. Storage

Comments

@sylr
Copy link

sylr commented Jun 17, 2019

Hi,

We came to notice calls to /subscriptions/<subscription>/resourceGroups/<group>/providers/Microsoft.Storage/storageAccounts/<storage>/listKeys?api-version=2018-07-01 returns a decremented x-ms-ratelimit-remaining-subscription-writes header leading to understand that this API is categorized as a WRITE operations where we believe it should be a READ one.

Is that a bug ?

Regards.

@mmyyrroonn
Copy link
Contributor

@sylr Thanks for opening this issue! I'm sorry I need some time to investigate this one. I will share any update with you here.

@mmyyrroonn
Copy link
Contributor

@stankovski would you please also check this issue?

@tombuildsstuff
Copy link
Contributor

tombuildsstuff commented Jun 20, 2019

to add some additional context from our side: this behaviour means that when a ReadOnly lock is applied to the storage account, it's not possible to read those keys, since that's a Write operation

@sergey-shandar
Copy link
Contributor

@XiaoningLiu @JasonYang-MSFT @vinjiang - Can you please take a look at this issue?

@blueww
Copy link
Member

blueww commented Jun 27, 2019

@huizlAzure
Would you please help to look at the issue on server behavior Storage Account listKey API?

@sylr
Copy link
Author

sylr commented Jul 29, 2019

Hi,

Could we have an update about this issue ?

Regards.

@musicislife08
Copy link

also looking for an update as we would like to use readonly management locks with terraform and this is preventing that

tombuildsstuff added a commit to hashicorp/terraform-provider-azurerm that referenced this issue Sep 5, 2019
…e user doesn't have permissions

When the user doesn't have permissions to access the ListKeys endpoint, either because the
Resource has a Write Lock (where ListKeys counts as a Write Operation, which is being tracked
in Azure/azure-rest-api-specs#6363) or because the user doesn't have
permissions - this now degrades these fields into empty values, rather than outright failing.

fixes #4138
@sylr
Copy link
Author

sylr commented Sep 13, 2019

@huizlAzure @blueww @myronfanqiu can we have a status on this ?

@mmyyrroonn
Copy link
Contributor

@huizlAzure Hello. Any update?

@mmyyrroonn mmyyrroonn added Storage Service Attention This issue is responsible by Azure service team. labels Sep 16, 2019
@blueww
Copy link
Member

blueww commented Sep 18, 2019

@sylr@musicislife08, @myronfanqiu
We have contact SRP and ARM team for this issue.
They are still discussion this issue. Will update when get result.

@zhusijia26
Copy link

@blueww any update on this issue? Or could you please assign this to the right person (who is looking into it)?

@zhusijia26 zhusijia26 added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Oct 29, 2019
@blueww
Copy link
Member

blueww commented Oct 30, 2019

Per the latest information I get, this is from ARM.

there is two level of throttling: the ARM level and the SRP level. x-ms-ratelimit-remaining-subscription-writes comes from ARM throttling.

There's a mail to ARM team, and I just ping it for responds.

BTW, this is not a swagger bug, but a server issue.

@kartikshah9
Copy link

@blueww request an update on this. If we need to consider re-assigning to a different team please initiate the thread and re-assign

@zhusijia26
Copy link

@blueww please provide an update on this issue.

@blueww
Copy link
Member

blueww commented Jan 9, 2020

@zhusijia26
I have ping ARM team again for this.
Will update this issue when get any update from them.

@blueww
Copy link
Member

blueww commented Feb 5, 2020

@zhusijia26
Following is the message I get from SRP/ARM team.
In a word, this is by design for security.

ListKeys retrieves secrets of the Storage Account therefore, it is modeled as a Write action by design for your account’s security, as Write operation requires higher privileged RBAC permissions. That said, we have taken actions to raise throttling limit for ListKeys to a much higher value. Please let us know if this resolves your issues.

@blueww
Copy link
Member

blueww commented Feb 5, 2020

@zhusijia26
As this is by design, I will close this issue.
Feel free to contact us if you need further assistance.

@blueww blueww closed this as completed Feb 5, 2020
@tombuildsstuff
Copy link
Contributor

@blueww sorry to push here - but the original issue here is that this design is not what users expect - presumably this should be a Read operation with a separate permission to retrieve this, rather than a Write operation? As it stands there's no means of retrieving the Storage Account Key via the API when there's a Write Lock on the storage account, since this counts as a Write operation?

As such could we re-open this issue and confirm with the ARM team if they plan to fix this?

Thanks!

@blueww
Copy link
Member

blueww commented Feb 6, 2020

@tombuildsstuff
When you get the storage account key, you can do write operation on storage objects (like container,blob ...). So for security reason, user with only read access, can't list storage account key.

Actually, we have discussed this with ARM team, and currently there's no plan to change this.

@tombuildsstuff
Copy link
Contributor

@blueww there’s a difference between Data Plane and Resource Manager operations. When there’s a write lock on the storage account this only affects Resource Manager operations - and not the Data Plane API.

However if you’re unable to get the Storage Account Key from the Resource Manager API due to the Write Lock you’ll be unable to upload content via the Data Plane API. An error is returned from the Storage Resource Manager API’s when trying to list the keys once a Write lock has been added to the storage account regardless of the users permissions.

It’s worth noting there’s entirely valid use-cases for a user/service principal having read-only access to the Resource Manager API to obtain one of the Primary/Secondary Storage Account Keys to be able to access the Data Plane API’s. Unfortunately this is required due to the flawed rollout of AzureAD authentication for the Storage API’s - where the new storage roles haven’t been backported to existing contributor/owner role assignments and instead only apply to new role assignments.

This ultimately means that we’ve had many users spend large amounts of time debugging AzureAD permissions with two users in the same role - and still be unclear about why these accounts have different permissions. Unfortunately this means that AzureAD authentication isn’t usable as the primary authentication mechanism for the Storage API’s at this time.

As such - can we please get this issue reopened and re-reach out to the ARM team here?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Service Attention This issue is responsible by Azure service team. Storage
Projects
None yet
Development

No branches or pull requests