Understanding Storage Account Security
This lesson explains how storage requests are authorized, which settings reduce exposure, and how data is encrypted.
Learning outcomes
After completing this lesson, you will be able to:
- Compare the ways of authorizing a storage request.
- Explain the effect of disabling Shared Key.
- Identify the baseline hardening settings.
- Compare the encryption key options.
Why storage needs attention
Azure Storage holds backups, logs, exports and application data, and a single account can contain terabytes of it. Publicly exposed storage is one of the most common causes of cloud data breaches. An account has a public endpoint by default, and several independent settings decide whether a request succeeds. Understanding each layer makes it possible to protect the account even if one layer fails.
A request to a storage account passes through network rules, then authorization, and the data is protected by encryption throughout. This lesson deals with the settings on the account, and the following lessons take up networking and data access in detail.
How requests are authorized
Azure Storage supports several ways to authorize a request. They are not equally safe, and the secure choice is to disable the weaker ones where possible.
| Method | How it works | Security view |
|---|---|---|
| Microsoft Entra ID | A token, with Azure RBAC data roles | Recommended: identity-based and auditable, with no shared secret |
| Shared Key | A request signed with an account key | An account key gives full control of the data, so disable it where possible |
| Shared access signature | A signed URL with limited rights and time | Useful for delegation; the safety depends on how it is signed |
| Anonymous access | No credentials, for public blobs | Disallow it, unless the content is meant to be public |
Account keys deserve particular attention. There are two, and each gives complete access to everything in the account. If a key leaks, an attacker can read and delete all the data, and also sign shared access signatures. Rotating keys limits the damage, and setting AllowSharedKeyAccess to false removes the risk altogether: requests signed with Shared Key then fail with error 403.
Disabling Shared Key safely
Turning off Shared Key is simple, but it can break applications that depend on it, and the property is not set by default, so null is treated as allowed. Before changing it, find out what uses Shared Key. Azure Monitor metrics can split requests by authentication type, and storage logs show the same detail.
The effect on signatures matters. A service SAS and an account SAS are both signed with an account key, so they stop working. A user delegation SAS is signed with Microsoft Entra credentials, so it continues to work, for Blob Storage only. Azure Files needs care as well, because the portal uses Shared Key for file shares by default, so apply this setting to accounts with Azure Files only after moving to RBAC.
az storage account update --name ACCOUNT --resource-group RG --allow-shared-key-access false
az storage account show --name ACCOUNT --resource-group RG --query allowSharedKeyAccessAzure Policy has the built-in definition Storage accounts should prevent shared key access, which can audit first and then deny. A change to the setting can take up to 30 minutes to take full effect.
Turning off Shared Key
Hardening settings
Beyond authorization, a set of account settings should be checked on every account. The following list gives the baseline.
- Secure transfer required: rejects HTTP requests, so that all traffic uses HTTPS.
- Minimum TLS version: set to TLS 1.2 or later, so that clients with weak protocols are refused.
- Allow Blob anonymous access: set to disabled. If it is disabled at account level, no container can be public.
- Allow cross-tenant replication: disable it unless it is needed, to stop data being copied to accounts in another tenant.
- Permitted scope for copy operations: limits where data can be copied from, which helps to prevent exfiltration.
- Default to Microsoft Entra authorization in the Azure portal: makes portal users access data with their own identity.
Storage hardening settings
Encryption at rest
All data in Azure Storage is encrypted at rest automatically with 256-bit AES, and this cannot be turned off. The choice concerns who manages the key.
With customer-managed keys, the account uses a managed identity with Key Vault Crypto Service Encryption User on the vault, and the vault needs soft delete and purge protection. Revoking the key makes data inaccessible, which provides a way to cut off access quickly, and which is also a serious risk if done by mistake. Infrastructure encryption adds a second layer, and it must be enabled when the account is created.
Who holds the key?
Protecting data from deletion
Several features protect data against deletion, whether accidental or malicious. Soft delete for blobs and containers keeps deleted items for a period. Blob versioning keeps earlier versions. Point-in-time restore returns containers to an earlier state. Immutable storage, described in the lesson on managing access, prevents all change for a period. A resource lock protects the account, but as the governance module explained, it does not protect the blobs.
Finding out whether Shared Key can be disabled
A security review requires that a storage account must stop accepting account key authentication. Some old applications use the account, and an external partner uses a service SAS. A week later, the requirement must be enforced for all accounts in the subscription. What should you do?
First, use storage metrics split by authentication type, or logs, to identify the callers. Move applications to managed identities with data roles, and replace the partner's service SAS with a user delegation SAS, because a service SAS will stop working. Then set AllowSharedKeyAccess to false, and assign the built-in policy in Audit before moving to Deny.
Rotating the keys would change them, but Shared Key would remain available. A stored access policy would help to control the service SAS, but it depends on an account key too, and so it would not survive the change.
A storage account has Shared Key disabled. Which SAS type still works?
Show answer
A user delegation SAS, because Microsoft Entra credentials sign it. Service and account SAS depend on the key.
Exam Tips
Remember for the exam
- Account keys give full control, so disable Shared Key where possible.
- Disabling Shared Key stops service and account SAS, but not user delegation SAS.
- Customer-managed keys need soft delete and purge protection on the vault.
- Infrastructure encryption must be enabled at account creation.