AZ-500 Microsoft Azure Security Technologies Exam
Are you a guardian of your domain? Lean how to leverage your aptitude in security to protect Microsoft Azure technologies, with a goal of earning the Microsoft Certified: Azure Security Engineer Associate certification!
Practice Test
Expert
Practice Test
Expert
Manage storage account access keys
Rotate and Regenerate Storage Account Access Keys
Azure Storage account access keys are shared symmetric keys generated when a storage account is created. They grant full control over the storage account and authenticate all client requests. Protecting these keys is critical to prevent unauthorized access. Managing them properly helps keep your data secure.
Regular key rotation and regeneration help maintain application availability and minimize security exposure. During rotation, you switch your application connection to the secondary key, then regenerate the primary one, avoiding downtime. Meanwhile, user delegation SAS tokens that rely on Microsoft Entra credentials remain valid through rotations. This separation ensures applications keep running while improving security.
You can automate rotation reminders with a key expiration policy that issues warnings at set intervals. After creating the policy, use Azure Policy to enforce compliance and detect any overdue rotations. Alerts from Azure Policy help you stay on schedule without manual checks. This process reduces the chance of expired or compromised keys.
You can rotate and regenerate keys using several methods to fit different scenarios. Common tools include Azure CLI, PowerShell, and the Azure portal:
- Azure CLI:
az storage account keys renew --resource-group <rg> --account-name <account> --key primary
(or--key secondary
) - PowerShell:
New-AzStorageAccountKey -ResourceGroupName <rg> -Name <account> -KeyName key1
(orkey2
) - Azure portal: Go to Security + networking > Access keys, switch your application to the secondary key, then click Regenerate for key1 and update your connection strings.
Each tool offers both command-line and GUI options, so choose what best integrates with your automation pipelines. This flexibility helps you integrate key rotation into your continuous integration and deployment workflows.
Only users with the Microsoft.Storage/storageAccounts/regeneratekey/action permission—such as Owner, Contributor, or Storage Account Key Operator Service Role—can regenerate keys. Always use one key at a time across all applications to avoid service disruptions. After regeneration, update your application settings to use the new key. These steps ensure uninterrupted service connectivity and compliance with security policies.
Conclusion
In summary, storage account access keys are shared symmetric keys that provide full access to your storage resources and must be safeguarded. Regular rotation via Azure portal, PowerShell, or Azure CLI, combined with key expiration policies and Azure Policy monitoring, helps maintain application availability and minimize security exposure. Grant the right permissions and use one key at a time to achieve uninterrupted service connectivity and compliance with security policies.