Azure rest apis to ListKeys of classic storage account

一个人想着一个人 提交于 2019-12-02 17:38:28

问题


I wanted to retrieve the access keys of classic storage account. I found this online

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

But this is not applicable for classic storage account. When I replace the Microsoft.Storage to Microsoft.ClassicStorage, it throws the following error

{
    "error": {
        "code": "InvalidRequestUri",
        "message": "The request uri is invalid. The requested path '/subscriptions/{subscriptionID}/resourceGroups/{myresourcegroup}/providers/Microsoft.ClassicStorage/storageAccounts/{myStorageAccount}/listKeys' is not found."
    }
}

NOTE: I am using Application permissions not delegated.


回答1:


For classic storage accounts, the documented way to list keys is using Service Management API (unfortunately I am not able to find the documentation).

You can get the keys for a classic storage accounts using ARM API as well however it is not supported and Microsoft may remove that API completely anytime. To do so, simply use the following URL:

https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ClassicStorage/storageAccounts/{accountName}/listKeys?api-version=2015-06-01

It is also recommended that you convert your classic storage accounts to ARM storage accounts if possible.



来源:https://stackoverflow.com/questions/45814332/azure-rest-apis-to-listkeys-of-classic-storage-account

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!