Storage Security
Secure transfer & TLS · encryption keys · firewall & private endpoints · Shared Key, SAS & stored access policies · Defender for Storage
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
Account-level settings
| Setting | Default | What it does |
|---|---|---|
| Secure transfer required | Enabled when you create the account | Rejects any REST request made over HTTP. Built-in Azure Policy can enforce it. The page's applicability note lists Azure Files as not covered; for Azure Files see its encryption-in-transit setting, which interacts with this one. |
| Minimum TLS version | Portal-created account: TLS 1.2. Created with PowerShell, CLI or template: not set (accepts TLS 1.0 or later) | Requests that use an older version fail. Valid values: TLS1_0, TLS1_1, TLS1_2. TLS 1.3 is supported but can't be enforced as the minimum. |
| Encryption at rest | On for every account; can't be disabled | Microsoft-managed keys by default. Customer-managed keys live in Key Vault or Managed HSM. |
| Infrastructure encryption | Off | Encrypts data twice (service level and infrastructure level) with two algorithms and two keys. |
| Immutable storage (WORM) | Off | Time-based retention or legal hold on blob data; no modify or delete while it applies. |
Customer-managed keys
- The key vault (or managed HSM) needs soft delete and purge protection on, and an RSA or RSA-HSM key of size 2048, 3072 or 4096.
- The identity the storage account uses (system-assigned or user-assigned managed identity) needs at least
wrapkey,unwrapkeyandgeton the key. - The account and the vault can be in different tenants, regions and subscriptions. You can switch between customer-managed and Microsoft-managed keys at any time.
- Blob Storage and Azure Files are always protected once the account uses a customer-managed key. Queue and Table data is protected only if you chose that when you created the account.
- Customer-provided keys are sent on individual Blob Storage requests. Encryption scopes apply a key to a container or an individual blob.
Immutable storage
| Policy | Behavior |
|---|---|
| Time-based retention | Objects can be created and read, not modified or deleted. After the interval ends, objects can be deleted but not overwritten. Interval: 1 day to 146,000 days. Starts unlocked for testing; a locked policy can't be deleted and its period can be extended but not shortened. |
| Legal hold | Same protection until the hold is explicitly cleared. Use it when the retention time is unknown. |
A time-based retention policy must be locked for the blobs to be in a compliant immutable state for SEC 17a-4(f) and similar rules. Container-level WORM sets policies at the container only; version-level WORM works at account, container or version level (needs versioning).
Storage firewall and private endpoints
By default a storage account accepts connections from any network. Network rules only take effect on the public endpoint, and a request from an allowed source must still meet the account's authorization requirements.
| Rule type | Use it for | Details |
|---|---|---|
| Virtual network rule | A subnet in an Azure virtual network | Up to 400 per account. Needs a service endpoint on the subnet (Microsoft.Storage = same region, Microsoft.Storage.Global = any region; only one of the two per subnet). The portal creates the endpoint for you; CLI and PowerShell don't. |
| IP network rule | Public IP ranges (for example on-premises, or the NAT addresses of ExpressRoute Microsoft peering) | Up to 400 per account. CIDR or single IPv4 only; no RFC 1918 private ranges; no /31 or /32 prefixes; no effect on same-region requests. |
| Resource instance rule | An Azure resource that can't be isolated by VNet or IP rules | The resource must be in the same tenant. The rule opens the public endpoint only; the resource's managed identity still needs an Azure role for data access. |
| Trusted service exception | Azure services outside your network boundary (for example Azure Backup for unmanaged disks, Azure Monitor, Event Grid) | Trusted services take the highest precedence over other network restrictions. Services under trusted access for resources registered in your tenant must be registered in a subscription in the same Entra tenant. |
- Rules apply only to data plane operations, not control plane. They apply to REST and SMB, but don't affect VM disk traffic.
- Rules do nothing until the default action is Deny. Set
--public-network-access Disabled(or Disable in the portal) to allow traffic only through a private endpoint. - Deleting a subnet removes it from the rules; a new subnet with the same name gets no access until you add it.
- A subnet with a service endpoint reaches the account with a private source IP, so IP rules for that subnet's public IP no longer have an effect.
Private endpoints
- Creating a private endpoint does not block the public endpoint. Configure the firewall to deny public access separately.
- The storage firewall controls only the public endpoint, so a VNet with a private endpoint needs no firewall rule.
- You need one private endpoint per storage service (Blobs, Data Lake Storage, Files, Queues, Tables, Static Websites). Blob-only endpoints make some Data Lake operations (Manage ACL, Create Directory, Delete Directory) fail, because they need a DFS endpoint.
- Not available for general-purpose v1 accounts. Clients keep the normal connection string; don't use the
privatelinkURL. - If the requester is also an owner of the storage account, the connection request is approved automatically.
Authorization and access keys
Every request to Azure Storage must be authorized. Microsoft recommends Microsoft Entra ID with managed identities wherever possible.
| Option | Notes |
|---|---|
| Microsoft Entra ID + Azure RBAC | Blob, queue and table data. A new account gives you no data access until you assign a data role (scope: subscription, resource group, account or container). To read blobs in the portal with Entra credentials you also need at least the Resource Manager Reader role. |
| Shared Key (account key) | Full access to the account's data and can sign SAS tokens. Two 512-bit keys; rotate them (Key Vault recommended). Rotation revokes account and service SAS tokens, not user delegation SAS. |
| Shared access signature | User delegation SAS (Entra credentials), service SAS and account SAS (account key). |
| Anonymous read access | Blob only; not recommended. |
| Storage local users | SFTP for blobs, SMB for files. |
Disallow Shared Key
AllowSharedKeyAccessisn't set by default, and Shared Key requests are allowed when it is null or true. Set it to false (portal: Allow storage account key access = Disabled).- Service SAS and account SAS requests are then denied. A user delegation SAS (Blob Storage) is still accepted.
- To protect an account with Conditional Access you must disallow Shared Key.
- Some Azure services and tools use Shared Key and stop working. The portal uses Shared Key for file shares by default, and Cloud Shell's file share becomes inaccessible.
- Set it with a role that has
Microsoft.Storage/storageAccounts/write(Owner, Contributor, Storage Account Contributor). Those roles also includelistkeys, so they can read the account keys. - Audit first: the built-in policy Storage accounts should prevent shared key access in audit mode, plus metrics and resource logs (needs a diagnostic setting) to find clients still using keys.
Anonymous access
Two settings apply: the account's AllowBlobPublicAccess and each container's access level. The account setting overrides the container.
| Container = Private | Container = Container | Container = Blob | |
|---|---|---|---|
| Account disallows anonymous | No access | No access | No access |
| Account allows anonymous | No access | Container and its blobs | Blobs only, not the container itself |
- Anonymous access is prohibited by default. A request that carries an
Authorizationheader ignores the anonymous setting and is authorized with its credentials. - If some containers must stay public, move them to a separate account reserved for that and disallow anonymous access everywhere else.
SAS and stored access policies
| SAS type | Signed with | With stored access policy? |
|---|---|---|
| User delegation SAS | Microsoft Entra credentials (user delegation key) | No, ad hoc only |
| Service SAS | Account key | Yes |
| Account SAS | Account key | No, ad hoc only |
- Creating a user delegation key needs an Azure role with
Microsoft.Storage/storageAccounts/blobServices/generateUserDelegationKey. - Azure Storage doesn't track SAS tokens, and you can't audit their generation. Anyone who can generate one can do so without the account owner knowing.
- A bad signature returns 403 (Forbidden).
- A SAS tied to an IP address limits the token holder but doesn't grant new access beyond the configured network rules.
SAS expiration policy
- Set an upper limit (
<days>.<hours>:<minutes>:<seconds>) on the account. Out-of-policy means no signed start, or a validity interval above the limit. - Actions: Log (default; out-of-policy requests are allowed and logged to
SasExpiryStatusif a diagnostic setting exists) or Block (denied). - With a policy in effect the signed start field is required on every SAS.
- A user delegation SAS lasts at most 7 days regardless of the policy. A limit above 7 days has no effect on it.
- Azure File Sync needs a limit of at least 3 days.
- You might have to rotate both account keys once before you can set the policy. Block isn't supported for user delegation SAS through the HDFS endpoint or for a service SAS bound to a stored access policy.
Stored access policy
- Defined on a blob container, file share, queue or table with
Set ACL. It controls start time, expiry and permissions of service SAS tokens bound to it, and can revoke them after they were issued. - A signed identifier is up to 64 characters. Up to five policies per resource; a sixth returns 400.
- A parameter can be on the SAS or on the policy, not both.
- New or changed policies can take up to 30 seconds; SAS tokens may get 403 meanwhile.
- Revoke by deleting the policy, changing its signed identifier, or setting the expiry in the past.
Defender for Storage
Agentless plan in Defender for Cloud. Enable it at the subscription (all existing and new accounts; you can exclude accounts) or at a single storage account. Microsoft recommends enabling by Azure built-in policy for scale, which can also cover management groups. No diagnostic logs are needed for its analysis.
| Feature | Notes |
|---|---|
| Activity monitoring | Analyzes data plane and control plane telemetry for anomalies, including entities without identities that use overly permissive or leaked SAS. |
| Sensitive data threat detection | Configurable; can be turned on or off at no extra cost. |
| Malware scanning | On-upload and on-demand scans with Microsoft Defender Antivirus. Priced per GB scanned; a configurable feature of the new plan. Default monthly cap 10,000 GB of uploaded blobs per account; two alerts at 75% and when the cap is reached. |
| Hash reputation analysis | Available in all plans. Doesn't cover SMB file shares or blobs created with Put Block / Put Block List. |
| Event-driven response | Event Grid integration for Functions or Logic Apps. |
Responding to malware
- Scan results arrive as Defender for Cloud alerts, Event Grid events and blob index tags.
- Soft delete malicious blobs is off by default, works at subscription or account level, quarantines the blob in place and retains it for 7 days by default (1 to 365).
- Logic App on Defender for Cloud alerts: no code, slower. Needs the Storage Blob Data Contributor role at subscription level and an alert filter on Malicious file uploaded to storage account.
- Function App on Event Grid: faster. The Event Grid custom topic must be in the same region as the storage account and can't be private-endpoint-only.
- ABAC conditions on blob access can block unscanned or malicious files.
CLI and PowerShell
| Task | Azure CLI | PowerShell |
|---|---|---|
| Require secure transfer | az storage account update -g {ResourceGroupName} -n {StorageAccountName} --https-only true | Set-AzStorageAccount -Name "{StorageAccountName}" -ResourceGroupName "{ResourceGroupName}" -EnableHttpsTrafficOnly $True |
| Default network action Deny | az storage account update --resource-group "myresourcegroup" --name "mystorageaccount" --default-action Deny | Update-AzStorageAccountNetworkRuleSet -ResourceGroupName "myresourcegroup" -Name "mystorageaccount" -DefaultAction Deny |
| Block all public network access | az storage account update --name MyStorageAccount --resource-group MyResourceGroup --public-network-access Disabled | Set-AzStorageAccount -ResourceGroupName "myresourcegroup" -Name "mystorageaccount" -PublicNetworkAccess Disabled |
| Enable service endpoint on a subnet | az network vnet subnet update --resource-group "myresourcegroup" --vnet-name "myvnet" --name "mysubnet" --service-endpoints "Microsoft.Storage.Global" | - |
| Add a virtual network rule | az storage account network-rule add --resource-group "myresourcegroup" --account-name "mystorageaccount" --subnet $subnetid | Add-AzStorageAccountNetworkRule -ResourceGroupName "myresourcegroup" -Name "mystorageaccount" -VirtualNetworkResourceId $subnet.Id |
| Add an IP network rule | az storage account network-rule add --resource-group "myresourcegroup" --account-name "mystorageaccount" --ip-address "16.17.18.0/24" | Add-AzStorageAccountNetworkRule -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -IPAddressOrRange "16.17.18.0/24" |
| Set trusted service exceptions | az storage account update --resource-group "myresourcegroup" --name "mystorageaccount" --bypass Logging Metrics AzureServices | Update-AzStorageAccountNetworkRuleSet -ResourceGroupName "myresourcegroup" -Name "mystorageaccount" -Bypass AzureServices,Metrics,Logging |
| Disallow Shared Key authorization | az storage account update --name <storage-account> --resource-group <resource-group> --allow-shared-key-access false | Set-AzStorageAccount -ResourceGroupName <resource-group> -AccountName <storage-account> -AllowSharedKeyAccess $false |
| Disallow anonymous blob access (on create) | az storage account create --name <storage-account> --resource-group <resource-group> --kind StorageV2 --location <location> --allow-blob-public-access false | New-AzStorageAccount -ResourceGroupName $rgName -Name $accountName -Location $location -SkuName Standard_GRS -AllowBlobPublicAccess $false |
| List account access keys | az storage account keys list --resource-group <resource-group> --account-name <storage-account> | (Get-AzStorageAccountKey -ResourceGroupName <resource-group> -Name <storage-account>).Value[0] |
Exam Tips
Tick each tip once you can answer it without looking.
“Container set to public access but anonymous reads still fail” → Account-level AllowBlobPublicAccess is false and overrides the container setting. Trap: The container access level alone never wins when the account disallows anonymous access.
“Protect a storage account with Conditional Access” → Disallow Shared Key authorization (AllowSharedKeyAccess false). Trap: Secure transfer and TLS settings don't bring Entra Conditional Access into play.
“Shared Key disallowed; which SAS still works on blobs” → User delegation SAS. Trap: Service SAS and account SAS are signed with the account key and are denied.
“Revoke a service SAS without touching account keys” → Delete or change the stored access policy it uses (or set its expiry in the past). Trap: SAS expiration policy Block isn't supported for a service SAS bound to a stored access policy; user delegation SAS can't use policies.
“IP rule for a VM in the same region has no effect” → Use a virtual network rule plus service endpoint. Trap: IP rules don't affect same-region requests and can't contain RFC 1918 addresses.
“Private endpoint created, internet still reaches the account” → Set default action Deny or public network access Disabled. Trap: A private endpoint doesn't block the public endpoint by itself.
“Data Lake Create Directory fails with only a Blob private endpoint” → Add a private endpoint for the Data Lake Storage (DFS) sub-resource. Trap: One endpoint per storage service.
“Customer-managed key for a storage account” → Key Vault with soft delete and purge protection, RSA key, identity with wrapkey/unwrapkey/get. Trap: The vault can be in another tenant or region, so same-region isn't a requirement.
“WORM needed for SEC 17a-4(f)” → Time-based retention policy, locked. Trap: An unlocked policy can still be changed or deleted; a locked one can't be deleted or shortened.
“Retention period unknown, data must not change” → Legal hold. Trap: A time-based policy needs a fixed interval.
“Auto-quarantine a malicious blob with no extra automation” → Soft delete malicious blobs (Defender for Storage). Trap: It's off by default and works only for malicious blobs; retention defaults to 7 days.
“Enable Defender for Storage across many subscriptions consistently” → Azure built-in policy at management group scope. Trap: Per-subscription portal clicks don't keep new subscriptions covered.
“Event Grid topic for malware scan events” → Same region as the storage account, public network access. Trap: Cross-region delivery and private-endpoint-only topics aren't supported.
“User with a blob data role can't browse blobs in the portal” → Add the Resource Manager Reader role. Trap: The data role alone isn't enough for the portal with Entra credentials.
“Can't set a SAS expiration policy (setting greyed out)” → Rotate both account keys first. Trap: Only needed for account-key signed SAS; keyCreationTime must not be null.
Sources
- Firewall rules and network access for Azure Storage
- Guidelines and limitations: Azure Storage firewall
- Set the default public network access rule
- Manage network security exceptions for Azure Storage
- Trusted Azure services for Azure Storage network security
- Create a virtual network rule for Azure Storage
- Create an IP network rule for Azure Storage
- Create a resource instance network rule for Azure Storage
- Use private endpoints - Azure Storage
- Require secure transfer
- Enforce a minimum required version of TLS
- Azure Storage encryption for data at rest
- Customer-managed keys for account encryption
- Immutable storage for blob data overview
- Authorize operations for data access
- Assign an Azure role for access to blob data
- Authorize blob access with Microsoft Entra ID
- Prevent authorization with Shared Key
- Remediate anonymous read access to blob data
- Manage account access keys
- Grant limited access with shared access signatures (SAS)
- Configure an expiration policy for SAS
- Define a stored access policy
- What is Microsoft Defender for Storage
- Deploy Microsoft Defender for Storage
- Set up automated remediation for malware detection
Checked against Microsoft Learn on November 13, 2026.