Recently, for one of my project requirements, I had to regenerate the access key for one of my storage accounts. This article will walk you through the syntax and usage of the az storage account keys renew command with specific examples so that you will get better clarity.
Table of Contents
Az storage account keys renew
This command helps you regenerate the access and Kerberos keys for a specified storage account.
Syntax
Below is the syntax of the az storage account keys renew command.
az storage account keys renew --storage -account-name --key (key1, key2, primary, secondary}) [--key-type {kerb}][--resource-group-name]Example-1
In the below example, I am regenerating the access key for the azureusanew storage account that belongs to the MyNewResGrp resource group.
az storage account keys renew -g MyNewResGrp -n azureusanew --key primaryAfter executing the above command, I got the successful output as below.
[
{
"creationTime": "2025-01-24T07:36:25.530187+00:00",
"keyName": "key1",
"permissions": "FULL",
"value": "vg7wDz6vBCwjed+YzBLXn66MwebY3mF6EFUIxdGGbXD9r2GrwI2mtrzFY58DESBeAMXIyTXRPmHd+AStgI3IuA=="
},
{
"creationTime": "2024-11-17T14:21:08.111950+00:00",
"keyName": "key2",
"permissions": "FULL",
"value": "JlBMGRx9VHaeYOhmON62FKP9jIFbSOE5m1kNnxc/0ep5fMKeV8gAzY/GmGei7PmLYLYkHrXMXMfE+AStRiCfuw=="
}
]You can find the same output shown in the screenshot below.

Or, Instead of primary key word for key type, you can specify key1 or key2 as mentioned below.
az storage account keys renew -g MyNewResGrp -n azureusanew --key key1After executing the above command, I got the expected output, as shown in the screenshot below.

Example-2
In the below example, I am regenerating the Kerberos keys for the azureusanew storage account that belongs to the MyNewResGrp resource group.
az storage account keys renew -g MyNewResGrp -n azureusanew --key secondary --key-type kerbAfter executing the above query, I got the expected output, as shown below.
[
{
"creationTime": "2025-01-24T08:03:11.782952+00:00",
"keyName": "key1",
"permissions": "FULL",
"value": "e7YgnwSKEww0zorA9W//YUK28ICjmZMISvnosebjEOEs7mIyNh8y4H4QV8Ej4bGbD0pxwDJMhK+X+AStPx/3Rg=="
},
{
"creationTime": "2024-11-17T14:21:08.111950+00:00",
"keyName": "key2",
"permissions": "FULL",
"value": "JlBMGRx9VHaeYOhmON62FKP9jIFbSOE5m1kNnxc/0ep5fMKeV8gAzY/GmGei7PmLYLYkHrXMXMfE+AStRiCfuw=="
},
{
"creationTime": "2025-01-24T08:09:56.533623+00:00",
"keyName": "kerb2",
"permissions": "FULL",
"value": "otZUBAHfBDvGvhj0p24Qpd3LECrOtFiCTstTWEm80MqxPzbvO+BODVvxvSW1Czq/m6DdZiPUy44j+AStMBrdMg=="
}
]You can see the same output in the below screenshot.

You may also like the following articles
- Az storage account show-connection-string
- az storage account keys list
- How To List The Storage Accounts In A Subscription On Azure PowerShell
- How To Restore Deleted Storage Account In Azure

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
