Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

Lesson 14 of 47
❮Prev Next❯

Create and Configure Storage Accounts and Encryption

Module 2: Storage ⏱ 12 min read Updated

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    30-second answer

    A storage account is created with a globally unique name (3 to 24 lowercase letters and numbers), a region, a performance tier (Standard general-purpose v2, or Premium block blobs, file shares or page blobs) and a redundancy option. Secure defaults to keep: secure transfer (HTTPS) required, minimum TLS 1.2, anonymous blob access off. All data is encrypted at rest with AES-256 automatically. You choose Microsoft-managed keys or customer-managed keys in Azure Key Vault or Managed HSM (the vault needs soft delete and purge protection, and the account needs a managed identity with access to the key). Infrastructure encryption adds a second layer and can only be enabled at creation.

    Simulate it » No Azure account needed

    Exam objective: 2.2.1 Create and configure storage accounts. 2.2.4 Configure storage account encryption. (Skills measured as of April 17, 2026)

    Simulations

    Feel it before you read it. No account needed, nothing leaves this page.

    Azure portal: Create a storage account with secure defaults and a customer-managed key Create a locked-down account, then move it to a customer-managed key.
    </> Embed

    Embed this simulation

    Free for trainers, teachers and bloggers. Paste this into your page:

    Loading the portal…

    Search for <strong>storage accounts</strong>.

    👆 Click the glowing item in the portal to continue

    Read the steps as text
    1. Search for storage accounts.
    2. Type storage accounts in the search bar and pick Storage accounts under Services.
    3. Select + Create.
    4. Basics: the name becomes part of the URL. Performance can’t change later. Redundancy can.
    5. Advanced: keep anonymous access off and TLS 1.2. The account’s default access tier can be Hot, Cool or Cold.
    6. Networking: limit the public endpoint to selected networks now, or use private endpoints only.
    7. Data protection: the portal turns on soft delete by default. The CLI doesn’t, so check it there.
    8. Encryption: data is always encrypted with AES-256. Infrastructure (double) encryption and key support for tables and queues can only be chosen now.
    9. Review and select Create.
    10. Go to the resource.
    11. Later, switch to a customer-managed key under Encryption. The account’s managed identity needs Key Vault Crypto Service Encryption User on the key.

    🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.

    😟 THE PROBLEM

    Compliance wants your own encryption key and no anonymous access, from day one.

    😊 THE SOLUTION

    Create the account with secure settings and switch to a customer-managed key.

    • Containers made public by mistake✓ Anonymous access off
    • Need control of the key✓ Customer-managed key
    • Want a second layer✓ Infrastructure encryption
    🛠️ Solved with: Storage account settings + CMK

    Start with a question

    Who should hold the key to your bank locker: you or the bank?

    Every locker in the bank vault is locked, whatever you do. The question is who keeps the key. For most people, letting the bank manage it is fine. Some customers want their own key so that, if they choose, nobody can open the locker, not even the bank.

    Azure Storage works the same way. Your data is always encrypted. You decide whether Microsoft manages the key or you bring a customer-managed key.

    Explain it like I’m 10

    The technical explanation

    Create the account: the decisions that matter

    Portal: Storage accounts > + Create. The wizard tabs are Basics, Advanced, Networking, Data protection, Encryption, Tags, Review + create.

    TabSettingNotes
    BasicsStorage account nameGlobally unique, 3 to 24 lowercase letters and numbers. Becomes https://<name>.blob.core.windows.net.
    BasicsPerformanceStandard (general-purpose v2, HDD-backed) or Premium (SSD) with an account type of block blobs, file shares or page blobs. Can’t be changed later.
    BasicsRedundancyLRS, ZRS, GRS, GZRS (and read-access versions). Can be changed later.
    AdvancedRequire secure transferHTTPS only for REST calls. Keep it on.
    AdvancedAllow enabling anonymous access on individual containersOff by default. Leave it off unless you publish public content.
    AdvancedEnable storage account key accessTurn off once everything uses Microsoft Entra ID.
    AdvancedMinimum TLS version1.2.
    AdvancedHierarchical namespaceTurns the account into Data Lake Storage Gen2. Some features, such as blob versioning, don’t support it.
    AdvancedAccess tierDefault tier for blobs: Hot, Cool or Cold.
    NetworkingPublic network accessAll networks, selected networks or disabled with private endpoints.
    Data protectionSoft delete and versioningThe portal turns soft delete on by default; the CLI doesn’t.
    EncryptionKey type, CMK support, infrastructure encryptionCovered below.

    Encryption at rest

    All data in Azure Storage (blobs, files, queues, tables, disks) is encrypted with 256-bit AES before it’s stored. There’s nothing to enable and no extra cost.

    • Microsoft-managed keys (MMK): the default. Microsoft rotates and protects the keys.
    • Customer-managed keys (CMK): you keep an RSA key in Azure Key Vault or Managed HSM. Storage uses it to wrap the account’s data encryption key. Requirements: the vault has soft delete and purge protection, and the account has a system-assigned or user-assigned managed identity with Key Vault Crypto Service Encryption User on the key. Leave the key version empty and storage picks up new versions automatically.
    • Infrastructure encryption: a second AES-256 layer with a different key. Create time only.
    • Encryption scopes: named key settings that can apply a different key to a container or even a single blob.
    • Customer-provided keys: a client sends its own key with each Blob Storage request. Rare, but it exists.

    At create time you also choose whether CMK support covers blobs and files only or all service types (tables and queues too); that can’t change later.

    If you disable the CMK or remove the identity’s access, storage can’t decrypt, so requests fail until you restore access. That’s the control customers want, and also the reason purge protection is mandatory.

    CLI and PowerShell

    # A secure general-purpose v2 account with double encryption
    az storage account create -g rg-storage-prod -n stcontosoprod -l eastus \
      --sku Standard_GZRS --kind StorageV2 --min-tls-version TLS1_2 \
      --allow-blob-public-access false --https-only true --require-infrastructure-encryption
    
    # Switch to a customer-managed key
    az keyvault create -g rg-storage-prod -n kv-contoso-cmk --enable-purge-protection true
    az storage account update -g rg-storage-prod -n stcontosoprod --assign-identity
    # (give the identity "Key Vault Crypto Service Encryption User" on the key, then:)
    az storage account update -g rg-storage-prod -n stcontosoprod \
      --encryption-key-source Microsoft.Keyvault \
      --encryption-key-vault https://kv-contoso-cmk.vault.azure.net \
      --encryption-key-name cmk-storage
    New-AzStorageAccount -ResourceGroupName rg-storage-prod -Name stcontosoprod -Location eastus `
      -SkuName Standard_GZRS -Kind StorageV2 -MinimumTlsVersion TLS1_2 `
      -AllowBlobPublicAccess $false -RequireInfrastructureEncryption
    Set-AzStorageAccount -ResourceGroupName rg-storage-prod -Name stcontosoprod `
      -KeyvaultEncryption -KeyVaultUri https://kv-contoso-cmk.vault.azure.net -KeyName cmk-storage
    Architect level Upgrading old accounts

    Older general-purpose v1 and BlobStorage accounts can be upgraded to general-purpose v2 in place (Configuration > Upgrade), which is a one-way change and can change your bill because of tier pricing. Premium accounts can’t become Standard and the reverse is also true: you create a new account and copy the data with AzCopy or object replication.

    Real-world business scenario

    Banking

    Woodgrove Bank (fictional)

    The problem
    Regulators required that the bank, not its cloud provider, could make customer statements unreadable on demand, with double encryption for new data.
    What they used
    New general-purpose v2 accounts created with infrastructure encryption, TLS 1.2, no anonymous access and no key access, then moved to a customer-managed key in a Key Vault with purge protection, reached through a user-assigned managed identity.
    Why that choice
    The bank owns the key, can disable it in an emergency, and gets two independent layers of AES-256.
    The result
    The audit passed, and key rotation is a new key version in Key Vault that storage picks up by itself.

    When to use it and when not to

    ✓ Use it when…

    • You are creating a new account and want secure defaults from day one.
    • Policy says your organization must own and be able to revoke the encryption key (CMK).
    • You need different keys for different customers inside one account (encryption scopes).

    ✕ Think twice when…

    • Microsoft-managed keys already meet your compliance needs; CMK adds work and a dependency on Key Vault.
    • You expect to switch Standard to Premium later (create a new account instead).
    • You plan to turn on infrastructure encryption for an existing account (not possible).

    ↔ Alternatives to consider

    • Managed HSM for FIPS 140-3 Level 3 key protection.
    • Encryption scopes for per-container keys.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    Test yourself with exercises

    5 original practice questions in the AZ-104 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.

    Question 1

    Question 1 of 5

    You need to create a storage account for SMB file shares that require consistently low latency. Which account configuration should you use?

    Question 2

    Question 2 of 5

    Your company requires a second layer of encryption for all data in a storage account that already exists. What should you do?

    Question 3

    Question 3 of 5 · Select 2

    You plan to configure a storage account to use a customer-managed key stored in Azure Key Vault. Which two requirements must be met? Each correct answer presents part of the solution.

    Question 4

    Question 4 of 5

    A storage account uses a customer-managed key. A security administrator disables the key in Azure Key Vault. What is the effect?

    Question 5

    Question 5 of 5

    You must create a storage account with the following requirements: only HTTPS requests are accepted, TLS 1.0 and 1.1 are refused, and no container can be made public. Which Azure CLI parameters should you include?

    Interview preparation

    Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.

    Beginner Is data in Azure Storage encrypted if I do nothing?

    Model answer

    Yes. Every byte written to Azure Storage is encrypted with 256-bit AES before it hits disk, and decrypted when you read it. You can't turn that off. What you can choose is who manages the key: Microsoft by default, or you with a customer-managed key in Key Vault.

    Intermediate Which storage account settings can't you change after creation?

    Model answer

    The name, the performance tier (Standard or Premium) and the premium account type, infrastructure encryption, and whether customer-managed keys can cover tables and queues. Redundancy, access tier, TLS version, network rules and the key source can all be changed later.

    Experienced developer What do you need before switching a storage account to a customer-managed key?

    Model answer

    A key vault or Managed HSM with soft delete and purge protection, an RSA or RSA-HSM key, and an identity for the storage account, system-assigned or user-assigned, with the Key Vault Crypto Service Encryption User role on the key (or get, wrapKey and unwrapKey in an access policy vault). If I leave the key version out, storage picks up new key versions automatically.

    Scenario Compliance says the company must be able to make storage data unreadable on demand. What would you set up?

    Model answer

    A customer-managed key in Key Vault. If the key is disabled or access is removed, storage can't unwrap the data encryption keys, so reads and writes fail until access is restored. I'd add infrastructure encryption on new accounts if they also want double encryption, and protect the vault with purge protection so nobody can destroy the key by accident.

    Quick revision

    Key points

    • Name is global, 3-24 lowercase letters and numbers; it becomes part of the endpoint URL.
    • Standard GPv2 for most work; Premium block blob, file share or page blob for low latency.
    • Keep secure transfer on, TLS 1.2 minimum, anonymous access off.
    • All data is AES-256 encrypted at rest. Keys are Microsoft-managed or customer-managed.
    • CMK needs a vault with soft delete and purge protection, and a managed identity with access.
    • Infrastructure encryption is create-time only.

    Important terminology

    General-purpose v2 (StorageV2)
    The standard storage account type for blobs, files, queues and tables, recommended for most scenarios.
    Premium storage account
    An SSD-backed account type for one service - block blobs, file shares or page blobs - with low latency.
    Storage service encryption
    Automatic AES-256 encryption of all data written to Azure Storage. It can't be turned off.
    Customer-managed key (CMK)
    An encryption key you own in Azure Key Vault or Managed HSM that protects the account's data encryption keys.
    Infrastructure encryption
    A second layer of AES-256 encryption at the infrastructure level, chosen only when the account is created.
    Encryption scope
    A named key setting inside an account that can apply a different key to a container or blob.

    Common mistakes

    • Trying to switch an existing account from Standard to Premium.
    • Pointing CMK at a vault without purge protection.
    • Forgetting to give the account an identity before choosing CMK.

    Exam tips

    • "Second layer of encryption" = infrastructure encryption (new account).
    • "Company must control and revoke the key" = customer-managed key in Key Vault.
    • "Different key per container" = encryption scope.

    Five quick revision questions

    1. 1.Which algorithm does Azure Storage use to encrypt data at rest?Show

      256-bit AES.

    2. 2.Can infrastructure encryption be enabled on an existing account?Show

      No, only when you create it.

    3. 3.Which role should the account's identity have on a CMK?Show

      Key Vault Crypto Service Encryption User.

    4. 4.What vault settings are required for CMK?Show

      Soft delete and purge protection.

    5. 5.Which account type is recommended for most scenarios?Show

      Standard general-purpose v2.

    Official references

    Finished this lesson? Tick it off. Your progress is saved in this browser.

    Next up: Storage Redundancy and Object Replication

    Studying with a friend? Send them this lesson

    It's free and needs no sign-up. Their progress saves in their own browser.

    Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges. Play ❯

    Install MSDEVBUILD Azure

    Free · no account · works offline

    Save the whole course for offline ›

    Hi, I’m your Nimbus

    Your study buddy. Pick what we do next.

    MSDEVBUILD · Multi-Stack Dev Build

    Sign in to MSDEVBUILD

    One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.