Storage Encryption
Service-side encryption · customer-managed keys · infrastructure encryption · encryption scopes
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
Key options
| Option | Who holds the key | Scope | Notes |
|---|---|---|---|
| Microsoft-managed keys | Microsoft (rotates them) | Account (default), container or blob (through an encryption scope), all services | Default for every new account |
| Customer-managed keys (CMK) | You, in Azure Key Vault or Managed HSM; you rotate | Account (default), or container or blob through an encryption scope | Blob and Files by default; queues and tables need an account created with All service types |
| Customer-provided keys | You; the client sends the key on each request | Individual Blob Storage requests | Blob Storage only. Azure doesn't store the key |
| Infrastructure encryption | Microsoft | A second layer with a different algorithm and key | Set only at account creation |
- Service-side encryption is always on. It uses 256-bit AES (GCM), is FIPS 140-2 compliant, costs nothing extra and can't be disabled.
- It covers all tiers (including archive), all redundancy options, blobs, queues, tables, disks and object metadata.
- Client-side encryption is a client library feature. Use v2 (AES-GCM). v1 (CBC) isn't recommended because of a vulnerability.
Customer-managed keys: requirements
- The key vault needs soft delete and purge protection enabled. Soft delete is on by default for new vaults and can't be disabled. Purge protection can be turned on at creation or later.
- The vault and the account can be in different regions or subscriptions, but in the same tenant.
- Key types: RSA and RSA-HSM, sizes 2048, 3072 or 4096.
- A managed identity authorizes the account to the vault. An existing account can use a system-assigned or user-assigned identity. A new account that configures CMK at creation must use a user-assigned identity.
- The identity needs Key Vault Crypto Service Encryption User on the vault. You need Key Vault Crypto Officer to create the key.
- Key version. Automatic: leave the version empty and Storage checks the vault once a day for a new version. Wait 24 hours before disabling the old version. Manual: you set the version and update it yourself. Storage doesn't rotate keys: rotation happens in Key Vault. Rotating needs no downtime.
- Revoke access by disabling the key in the vault. Data stays encrypted but reads and writes fail until you re-enable it.
- You can switch back to Microsoft-managed keys at any time.
| Step | Action |
|---|---|
| 1 | Create or choose a key vault with purge protection (soft delete on) |
| 2 | Give yourself Key Vault Crypto Officer and create an RSA key |
| 3 | Choose a managed identity for the account |
| 4 | Grant that identity Key Vault Crypto Service Encryption User on the vault |
| 5 | Storage account › Security + networking › Encryption › Customer-managed keys: select vault, key and identity, then Save |
Infrastructure encryption
- A second encryption layer at the infrastructure level, with a different algorithm and key. The key is always Microsoft-managed.
- You must enable it when you create the account. You can't enable or disable it afterwards. To add it later, create a new account and copy the data.
- Supported account types: general-purpose v2, premium block blob, premium page blob.
- Recommended only when compliance requires it. An Azure Policy built-in can require it.
- Portal: create account › Encryption tab › Enable infrastructure encryption.
Encryption scopes (Blob only)
- A key scoped to a container or an individual blob, Microsoft-managed or customer-managed. Use them for secure boundaries between customers in one account.
- A container's default scope must be set when the container is created. Either prevent override (every blob uses it; uploading with another scope fails) or permit override (an upload with another scope succeeds).
- A scope's infrastructure encryption setting can't change after creation. A scope can switch between Microsoft-managed and customer-managed keys at any time.
- Scopes can't be deleted, only disabled. A disabled scope returns 403 on reads and writes. Billing has a 30-day minimum after enabling, then hourly.
- Up to 10,000 scopes with auto-updating customer-managed key versions.
- A blob with an encryption scope can't move to the archive tier, and its default tier can't be changed.
- To use a CMK scope, the account needs CMK configured with a managed identity that holds Key Vault Crypto Service Encryption User, and the vault needs purge protection.
- Disable a scope before you revoke its key, so you aren't billed for a scope that can't work.
- Portal: Security + networking › Encryption › Encryption Scopes › Add. Container default: New container › Advanced › Encryption scope.
CLI and PowerShell
| Task | Azure CLI | PowerShell |
|---|---|---|
| Create a vault with purge protection and RBAC | az keyvault create --name <kv> --resource-group <rg> --location <loc> --enable-purge-protection --enable-rbac-authorization | New-AzKeyVault -Name <kv> -ResourceGroupName <rg> -Location <loc> -EnablePurgeProtection -EnableRbacAuthorization |
| Create a key | az keyvault key create --name <key> --vault-name <kv> | Add-AzKeyVaultKey -VaultName <kv> -Name <key> -Destination Software |
| Assign a system identity to the account | az storage account update --name <n> --resource-group <rg> --assign-identity | Set-AzStorageAccount -ResourceGroupName <rg> -Name <n> -AssignIdentity |
| Enable CMK (automatic version) | az storage account update ... --encryption-key-name <key> --encryption-key-version "" --encryption-key-source Microsoft.Keyvault --encryption-key-vault <vaultUri> | Set-AzStorageAccount ... -KeyvaultEncryption -KeyName <key> -KeyVersion "" -KeyVaultUri <uri> |
| Back to Microsoft-managed keys | az storage account update ... --encryption-key-source Microsoft.Storage | Set-AzStorageAccount ... -StorageEncryption |
| Revoke (disable the key) | az keyvault key set-attributes --vault-name <kv> --name <key> --enabled false | Update-AzKeyVaultKey -VaultName <kv> -Name <key> -Enable $false |
| Create an account with infrastructure encryption | az storage account create ... --require-infrastructure-encryption | New-AzStorageAccount ... -RequireInfrastructureEncryption |
| Create an encryption scope (Microsoft key) | az storage account encryption-scope create --resource-group <rg> --account-name <n> --name <scope> --key-source Microsoft.Storage | New-AzStorageEncryptionScope -ResourceGroupName <rg> -StorageAccountName <n> -EncryptionScopeName <scope> -StorageEncryption |
| Create an encryption scope (CMK) | ... --key-source Microsoft.KeyVault --key-uri <uri> | New-AzStorageEncryptionScope ... -KeyUri <uri> -KeyvaultEncryption |
| Container with default scope, no override | az storage container create --account-name <n> --name <c> --default-encryption-scope <scope> --prevent-encryption-scope-override true --auth-mode login | New-AzStorageContainer -Name <c> -Context $ctx -DefaultEncryptionScope <scope> -PreventEncryptionScopeOverride $true |
| Upload a blob with a scope | az storage blob upload ... --encryption-scope <scope> | Set-AzStorageBlobContent ... -EncryptionScope <scope> |
| Disable a scope | az storage account encryption-scope update ... --state Disabled | Update-AzStorageEncryptionScope ... -State disabled |
Exam Tips
Tick each tip once you can answer it without looking.
“Is data in a new storage account encrypted?” → Yes, always, with Microsoft-managed keys; it can't be turned off. Trap: enabling encryption in Configuration.
“The customer must control and rotate the keys” → Customer-managed keys in Key Vault. Trap: customer-provided keys are sent by the client on each request and are Blob only.
“Key vault requirements for CMK” → Soft delete and purge protection both enabled. Trap: soft delete alone.
“Which role does the account's managed identity need on the vault?” → Key Vault Crypto Service Encryption User. Trap: Key Vault Contributor or Reader.
“New account configured with CMK at creation: which identity?” → A user-assigned managed identity, created first. Trap: system-assigned.
“Enable double encryption on an existing account” → Not possible: infrastructure encryption is set at creation. Create a new account and copy the data. Trap: a toggle on the Encryption blade.
“Key rotated in the vault, old version disabled at once, access broke” → Storage checks once a day: wait 24 hours, or set the new version manually. Trap: rotation being instant.
“Temporarily block all access to data in a CMK account” → Disable the key in Key Vault. Trap: deleting an account access key: access keys are unrelated.
“Different customers' data in one account, each with its own key” → Encryption scopes. Trap: separate Shared Key access keys.
“Every blob in a container must use the same scope” → Set a default scope and prevent override when you create the container. Trap: changing the container default later.
“Delete an encryption scope” → Not possible: disable it (30-day minimum billing). Trap: a delete command.
“Upload to a container that prevents override, naming a different scope” → The upload fails. Trap: it succeeding with the scope you named.
“CMK for queues and tables” → The account must be created with CMK support for all service types. Trap: enabling it later on the Encryption blade.
“Switch an account from CMK back to Microsoft-managed keys” → Allowed at any time. Trap: recreating the account.
“Key types allowed for CMK” → RSA or RSA-HSM: 2048, 3072 or 4096 bits. Trap: EC keys.
“Move a blob that has an encryption scope to the archive tier” → Not possible. Trap: scopes don't affect tiering.
Sources
- Encryption for data at rest
- Configure customer-managed keys for an existing account
- Enable infrastructure encryption
- Encryption scopes overview
- Create and manage encryption scopes
- Create a storage account
Checked against Microsoft Learn on November 13, 2026.