0

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.

Darrel Miller
  • 139,164
  • 32
  • 194
  • 243

1 Answers1

4

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.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • Thank you so much! I cannot use method 1, as I am actually attempting to replace service management api's with the azure rest api's because service managements api's wont support application permissions. With method 2, Still I am getting the same error - InvalidRequestUri – Hari Priya Thangavel Aug 22 '17 at 10:34
  • Can you please try with any of the following api versions: 2016-11-01, 2016-04-01, 2015-12-01, 2015-06-01, 2014-06-01, 2014-04-01-beta, 2014-04-01, 2014-01-01? I just tried with 2015-06-01 version and I was able to list the keys. – Gaurav Mantri Aug 22 '17 at 10:47
  • Its working now!!!!! it was a postman error, With Advanced rest api client it worked... Thank you so much !! :-) – Hari Priya Thangavel Aug 22 '17 at 12:43
  • Can you help me with this too , https://stackoverflow.com/questions/45834981/how-to-get-the-configuration-of-cloudserviceclassic-with-azure-arm-api – Hari Priya Thangavel Aug 23 '17 at 09:24