Is it possible to Rotate Azure classic storage account keys using az commands ?

2022-03-04T11:35:22.917+00:00

Hi need support to find a way to rotate azure classic storage account keys ( don't have azure portal UI access trying to connect via 1ES secure pool agent pipeline ), at the moment I am using following document to do so:

https://learn.microsoft.com/en-us/cli/azure/storage/account/keys?view=azure-cli-latest#az-storage-account-keys-renew

az storage account keys renew --account-name
--key {primary, secondary}
[--key-type {kerb}]
[--resource-group]
[--subscription]

I do have storage account (classic storage account) name and resource group name with me but not able find any attribute to instruct above command to run for classic storage account type while renewing the keys however its picking up normal storage account by default and key renewal failing by stating following error message ' storage account not found in the resource group '.

Message: The Resource 'Microsoft.Storage/storageAccounts/<storage-account>' under resource group '<rg>' was not found, where as

az resource list --query "[?name=='<storage-account>']" command returning <rg> correct name along side type which is:

[
{
"type": "Microsoft.ClassicStorage/storageAccounts"
}
]

Thanks

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,944 questions
0 comments No comments
{count} votes

Accepted answer
  1. deherman-MSFT 35,636 Reputation points Microsoft Employee
    2022-03-04T21:02:35.283+00:00

    @Jeevan Kumar (ZEN3 INFOSOLUTIONS AMERICA INC)

    I understand you are trying to rotate the key for your classic storage account using the CLI. Please correct me if I am misunderstanding.

    Classic storage account is not supported in the latest CLI as it does not use the ARM deployment model. More information about this can be found here. Migration from classic to ARM is possible and I would recommend looking into performing this in the future.

    In order to manage classic resources via CLI you must install the classic CLI. Once the classic CLI is installed you can run the following to login, set subscription, change config mode, then rotate the key.

    azure login  
    azure account set "subscriptionname"  
    azure config mode asm  
    azure storage account keys renew storageaccountname --primary or --secondary  
    

    Hope this helps you. Let me know if you run into any problems or have further questions.

    -------------------------------

    Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful