Azure Rest API到经典存储帐户的ListKeys

问题描述:

我想检索经典存储帐户的访问密钥. 我在网上找到了

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

但这不适用于经典存储帐户.当我将Microsoft.Storage替换为Microsoft.ClassicStorage时,它将引发以下错误

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.

对于传统的存储帐户,列出密钥的记录方法是使用服务管理API(不幸的是,我找不到该文档).

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

您也可以使用ARM API获取传统存储帐户的密钥,但是不支持该密钥,Microsoft随时可能会完全删除该API.为此,只需使用以下URL:

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

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

如果可能,还建议您将经典存储帐户转换为ARM存储帐户.

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