简体   繁体   English

通过REST API在Azure中重新生成访问密钥

[英]Regenerating access keys in Azure by REST API

For Azure there is an API Endpoint that allows to regenerate key. 对于Azure,有一个API端点可以重新生成密钥。 The endpoint looks like 端点看起来像

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey?api-version=2017-06-01

Documentation states 文档状态

When you have code that needs to access or modify resources, you must set up an Azure Active Directory (AD) application. 当您具有需要访问或修改资源的代码时,必须设置一个Azure Active Directory(AD)应用程序。

However, when I use it (ie create POST request) I'm getting error Authentication failed. The 'Authorization' header is missing. 但是,当我使用它(即创建POST请求)时,出现错误Authentication failed. The 'Authorization' header is missing. Authentication failed. The 'Authorization' header is missing. I tried to follow this tutorial and I did all the steps except Assign application to role What role should I select to be able to regenerate password? 我尝试按照本教程进行操作 ,除了将应用程序分配给角色以外,我已完成所有步骤,我应该选择哪个角色才能重新生成密码? How do I do that? 我怎么做? Am I getting this correct? 我得到这个正确吗?

I think you could use Storage Account Key Operator Service Role . 我认为您可以使用“ 存储帐户密钥操作员服务角色”

The Storage Account Key Operators are allowed to list and regenerate keys on Storage Account . 允许存储帐户密钥操作员列出和重新生成存储帐户上的密钥

Storage Account Contributor : Lets you manage storage accounts, but not access to them. 存储帐户提供者 :使您可以管理存储帐户,但不能访问它们。

Contributor :Lets you manage everything except access to resources. 贡献者 :让您管理除资源访问以外的所有内容。

If you have some more action to operate, you could use more powerful roles, but if you only want to regenerate key, I suggest that you could use Storage Account Key Operator Service Role. 如果要执行更多操作,则可以使用功能更强大的角色,但是,如果仅想重新生成密钥,建议您使用“存储帐户密钥操作员服务角色”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM