Azure storage accounts and redundancy
-
Phase 0: Before you start
-
Phase 1: The foundation
-
Phase 2: Day-to-day operations
-
Phase 3: Enterprise architecture
-
Phase 4: Troubleshooting step by step
-
Phase 5: Final project and career
An Azure storage account is the container that holds all your blobs, file shares, queues and tables. It gives them one name and one set of network and security rules, and it’s where you choose how many copies Azure keeps and where it keeps them.
That redundancy choice decides whether your data survives a disk failure, a fire in a data centre or a whole region going down, and it’s also one of the easiest ways to double a storage bill without meaning to.
In the lab you’ll create the storage account you’ll keep using for the next five lessons, switch its redundancy, and fix the two permission errors that every new admin runs into.
| Time | You need | Cost | By the end you can |
|---|---|---|---|
| About 40 minutes | The CLI, your signed-in account | A few US cents per month for a few files on LRS, inside the free account’s 5 GB of hot blob storage | Create a secure storage account, choose and change redundancy, and use Entra ID data roles |
What it is, in one line
A storage account is a named home for your Azure data, and it decides how that data is secured, reached and copied.
In Simple Words
Copies of your family photos
Keeping three prints of a photo in one album is LRS: a torn page doesn’t matter, but a flood in the house takes all three. Keeping one print in each of three rooms on different floors is ZRS, and posting another set to your aunt in another city is GRS. You can only look at her set if she agrees to show it, and that’s the part RA-GRS adds.
None of this helps if you throw a photo in the bin yourself, because every copy follows what you do and the deleted photo vanishes everywhere. For that you need soft delete and backups, not more copies.
Engineer's View
Account types, redundancy and secure defaults
- Standard general-purpose v2 (
StorageV2): handles blobs, files, queues and tables with every redundancy option, so it’s what you use unless you need premium speed. - Premium block blobs, premium file shares and premium page blobs: backed by SSD, one data type each, and only LRS or ZRS.
- Names: 3 to 24 lowercase letters and numbers, and unique across all of Azure, since each name turns into a web address like
stsaat12345.blob.core.windows.net.
- LRS: 3 copies in one data centre.
- ZRS: 3 copies spread over 3 zones in the region, so a building can fail without any data loss.
- GRS: LRS plus an asynchronous copy (3 more) in the paired region, which is South India for Central India. The most recent writes can be lost if there’s a regional failover.
- GZRS: ZRS plus the paired-region copy.
- RA-GRS / RA-GZRS: the same, but you can also read the secondary copy at a
-secondaryaddress. - Changing it: switching between LRS and GRS/RA-GRS is done with
az storage account update --sku. Moving to or from ZRS or GZRS is a conversion (az storage account migration start) that can take hours or even days, or else you copy everything to a new account.
- Secure defaults for new accounts: HTTPS only, TLS 1.2 as the minimum and anonymous blob access switched off. Leave them that way.
- Control plane vs data plane: Owner or Contributor lets you manage the account but doesn’t let you read its data with Entra ID. For the data you need roles like
Storage Blob Data Contributor. - CLI gotcha:
az storage account createquietly defaults toStandard_RAGRS, so always pass--sku.
How it works, step by step
Here’s what happens when an app writes a blob to a GRS account:
- The app sends its write to the primary region (Central India).
- Azure writes 3 copies in the primary data centre, and only after that does it reply “success”.
- Then in the background Azure copies the change across to the paired region (South India), normally within minutes.
- The paired region keeps its own 3 copies, but you can’t read them unless the account is RA-GRS or there’s been a failover.
- During a failover the secondary takes over as primary. Anything that hadn’t been copied yet is lost, and the account drops to LRS until you set GRS again.
ZRS works another way: the write lands in three zones at once before Azure replies “success”, so an entire zone can fail without losing data and without any failover.
As a rule of thumb, use ZRS for production in regions that have zones, GZRS when the data has to survive a regional disaster, and LRS for dev/test and anything you can rebuild.
Hands-on lab: create your Azure storage account
Before you run any command, double-check it
Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.
1Check a name before you create it
Try one bad name and one good one:
az storage account check-name --name St-Saat
$st = "stsaat" + (Get-Random -Minimum 10000 -Maximum 99999)
az storage account check-name --name $st --query nameAvailableYou should see something like this:
{
"message": "St-Saat is not a valid storage account name. Storage account name must be between 3 and 24 characters in length and use numbers and lower-case letters only.",
"nameAvailable": false,
"reason": "AccountNameInvalid"
}
true2Create the course storage account
You’ll keep this account for Lessons 22 to 26, so it goes into its own kept group. Save the name for later:
az group create --name rg-saat-data --tags course=saatvedha-azure lesson=21 keep=true -o none
az storage account create --resource-group rg-saat-data --name $st --location centralindia --sku Standard_LRS --kind StorageV2 --access-tier Hot --min-tls-version TLS1_2 --https-only true --allow-blob-public-access false --tags course=saatvedha-azure lesson=21 keep=true -o none
Set-Content -Path C:\azure-lab\storage.txt -Value $st
az storage account show --resource-group rg-saat-data --name $st --query "{name:name, kind:kind, sku:sku.name, tier:accessTier, tls:minimumTlsVersion, publicBlob:allowBlobPublicAccess, blob:primaryEndpoints.blob}" -o tableYou should see something like this:
Name Kind Sku Tier Tls PublicBlob Blob
----------- --------- ------------ ------ ------ ------------ ---------------------------------------
stsaat48213 StorageV2 Standard_LRS Hot TLS1_2 False https://stsaat48213.blob.core.windows.net/In a new PowerShell window later, load the name with $st = (Get-Content C:\azure-lab\storage.txt).
3Give yourself a data role and upload a file
Run this:
$id = az storage account show --resource-group rg-saat-data --name $st --query id -o tsv
$me = az ad signed-in-user show --query id -o tsv
az role assignment create --assignee $me --role "Storage Blob Data Contributor" --scope $id -o none
Start-Sleep -Seconds 120
az storage container create --account-name $st --name lab --auth-mode login -o none
Set-Content -Path C:\azure-lab\hello.txt -Value 'hello from lesson 21'
az storage blob upload --account-name $st --container-name lab --name hello.txt --file C:\azure-lab\hello.txt --auth-mode login -o none
az storage blob list --account-name $st --container-name lab --auth-mode login --query "[].{name:name, bytes:properties.contentLength, tier:properties.blobTier}" -o tableYou should see this:
Name Bytes Tier
--------- ------- ------
hello.txt 22 Hot--auth-mode login uses your Entra ID sign-in instead of the account key. The two-minute wait gives the role assignment time to reach the storage service.
4Switch to GRS and see the paired region
Run this:
az storage account update --resource-group rg-saat-data --name $st --sku Standard_GRS -o none
az storage account show --resource-group rg-saat-data --name $st --query "{sku:sku.name, primary:primaryLocation, secondary:secondaryLocation, secondaryStatus:statusOfSecondary}" -o tableYou should see something like this:
Sku Primary Secondary SecondaryStatus
------------ ------------ ----------- -----------------
Standard_GRS centralindia southindia availableSouth India is Central India’s pair, so the copy goes there. If Azure says the change isn’t allowed right now, wait a bit and try again, it happens now and then.
5Switch back to LRS
GRS costs more, so switch back for the lab:
az storage account update --resource-group rg-saat-data --name $st --sku Standard_LRS -o none
az storage account show --resource-group rg-saat-data --name $st --query "sku.name" -o tsvYou should see this:
Standard_LRS
✅ Checkpoint: Your storage account is Standard_LRS, StorageV2, Hot, TLS 1.2, no public access, and lab/hello.txt is in it. Its name is in C:\azure-lab\storage.txt.
Break It, Then Fix It
Every storage admin gets these two errors, usually in their first week on the job.
1Break it: “But I’m the Owner!”
Remove your data role (pretend you’re a teammate who only has Owner), wait, and then list the blobs:
az role assignment delete --assignee $me --role "Storage Blob Data Contributor" --scope $id
Start-Sleep -Seconds 120
az storage blob list --account-name $st --container-name lab --auth-mode login -o tableYou’ll get this error:
You do not have the required permissions needed to perform this operation.
Depending on your operation, you may need to be assigned one of the following roles:
"Storage Blob Data Owner"
"Storage Blob Data Contributor"
"Storage Blob Data Reader"
"Storage Queue Data Contributor"
"Storage Queue Data Reader"
"Storage Table Data Contributor"
"Storage Table Data Reader"
If you want to use the old authentication method and allow querying for the right account key, please use the "--auth-mode" parameter and "key" value.Owner covers the control plane, which is creating, changing and deleting the account. Reading blobs with Entra ID belongs to the data plane and needs a data role. Behind this message the service code is AuthorizationPermissionMismatch.
Fix it: assign the smallest data role that does the job, at the narrowest scope (the account, in this case):
az role assignment create --assignee $me --role "Storage Blob Data Contributor" --scope $id -o none
Start-Sleep -Seconds 120
az storage blob list --account-name $st --container-name lab --auth-mode login --query "[].name" -o tsvYou should see this:
hello.txtDon’t “fix” it by switching to --auth-mode key. Account keys open everything in the account, and plenty of companies turn them off (Lesson 24).
2Break it: “Just make the container public”
Now try to create a container that anyone on the internet can read:
az storage container create --account-name $st --name public --public-access blob --auth-mode loginYou’ll get an error like this:
Public access is not permitted on this storage account.
ErrorCode:PublicAccessNotPermittedThe account setting beats the container setting. That’s the secure default working as intended, and it’s the reason “public” links that worked on an old account fail on a new one.
Fix it: keep the container private and share it with a time-limited SAS link (Lesson 24). Create it as private:
az storage container create --account-name $st --name public --auth-mode login -o none
az storage container delete --account-name $st --name public --auth-mode login -o none
C:\azure-lab\Find-LabResources.ps1 -Lesson 21You should see something like this (the kept account only):
Resource groups:
name lesson location
---- ------ --------
rg-saat-data 21 centralindia
Resources:
name type group lesson
---- ---- ----- ------
stsaat48213 Microsoft.Storage/storageAccounts rg-saat-data 21
✅ Checkpoint: Your data role is back, no public container exists, and the storage account is kept for Lesson 22.
This happened at work
“Azure keeps three copies, so we’re safe”
A logistics company kept five years of delivery proofs (signed photos) in a single storage account. The account was GRS and the team was quite proud of it, since that meant six copies in two regions.
Then during a cleanup, a script pointed at the wrong container name deleted 1.2 million blobs in under an hour, and minutes later the delete reached the secondary region, exactly as it was designed to. Blob soft delete was off and there was no backup, and a week later the customer disputes that needed those photos started coming in.
What they changed: they switched on soft delete for blobs and containers (Lesson 23), turned on versioning for the proofs container, put a resource lock on the account and added Azure Backup for blobs. Cleanup scripts now run with a data role scoped to a single container, and redundancy gets described as “protection from hardware loss”, never as backup.
Common mistakes and troubleshooting
| Mistake | What you see | What to do |
|---|---|---|
No --sku on az storage account create | RA-GRS bill on a dev account | Always pass --sku with Standard_LRS or ZRS. |
| Owner, but no data role | “You do not have the required permissions” | Assign Storage Blob Data Reader or Contributor. |
| Using account keys to get around RBAC | Full access leaked in scripts | Use --auth-mode login along with data roles. |
| Expecting public containers on new accounts | PublicAccessNotPermitted | Use SAS links or a CDN, and leave public access off. |
| Treating GRS as backup | Deletes replicate everywhere | Switch on soft delete, versioning and backups. |
Trying update --sku to reach ZRS | Change refused | Use az storage account migration start, or copy to a new account. |
| Capital letters or hyphens in the name | AccountNameInvalid | Stick to 3 to 24 lowercase letters and numbers. |
Interview questions
Click a question to open it. Each one is phrased the way an interviewer would ask it, and underneath you’ll find why they ask it and one way you could answer in your own words.
Fresher level
1. What redundancy options does Azure Storage offer?
Why they ask this: It’s the main idea here.
How you might answer: LRS keeps 3 copies in one data centre and ZRS keeps 3 copies across zones. GRS adds 3 more copies in the paired region, and GZRS combines ZRS with the paired region. The RA-GRS and RA-GZRS versions also let you read the secondary copy.
2. What are the rules for a storage account name?
Why they ask this: It’s basic, but it comes up a lot.
How you might answer: It has to be 3 to 24 characters, only lowercase letters and numbers, and unique across the whole of Azure, because the name ends up in the public endpoint address.
3. I’m Owner of the subscription. Why can’t I list blobs?
Why they ask this: They want to see if you know control plane from data plane.
How you might answer: Owner lets me manage the resource but doesn’t give me data access through Entra ID. I’d need a data role such as Storage Blob Data Reader or Contributor on the account or the container.
2–5 years experience
4. ZRS or GRS for a production app in Central India?
Why they ask this: They want your reasoning, not a slogan.
How you might answer: ZRS covers a zone failure with no data loss and no failover, and that handles most outages. GRS covers a regional disaster, but it replicates asynchronously so recent writes can be lost. If the app needs both, I’d go with GZRS.
5. How do you change an account from LRS to ZRS?
Why they ask this: They want to hear that it isn’t a simple update.
How you might answer: Going between LRS and GRS is just an update, but getting to ZRS needs a conversion with az storage account migration start, which can take a long time, or a copy into a new ZRS account using AzCopy. I’d treat it as a planned change and not a quick fix.
6. A developer asks you to make a container public. What do you do?
Why they ask this: They’re testing your security judgement.
How you might answer: First I’d ask who or what needs to read it and for how long. Most of the time a SAS with a short expiry, or a CDN in front, does the job. New accounts block anonymous access by default and I’d want to keep it like that.
Senior level
7. How would you design storage security for a large company?
Why they ask this: They want to see controls in layers.
How you might answer: I’d use Entra ID data roles with least privilege and turn off shared key access wherever the apps allow it. Then private endpoints and the storage firewall, TLS 1.2 as the minimum, Azure Policy to enforce those settings, and Defender for Storage. Soft delete, versioning and locks cover us against mistakes.
8. What happens in a customer-managed failover of a GRS account?
Why they ask this: They want the details that catch people out later.
How you might answer: The secondary region becomes the primary and the endpoint DNS moves over to it. Any writes that hadn’t replicated are lost, so I’d check the last sync time before starting. After the failover the account is LRS in the new region, so I’d set geo-redundancy again.
9. Redundancy versus backup: how do you explain the difference to management?
Why they ask this: They want to see you can explain things clearly.
How you might answer: I’d say redundancy keeps the service running when hardware or a site fails, and backup lets us go back in time after a mistake, an attack or corruption. Redundancy copies deletes and ransomware just as faithfully as good data, which is why we need both.
Quick quiz
Q1. Which redundancy keeps 3 copies across availability zones?
- LRS
- ZRS
- GRS
- RA-GRS
Show answer
B — ZRS writes to three zones in the region.
Q2. What is the CLI default SKU for az storage account create?
- Standard_LRS
- Standard_ZRS
- Standard_RAGRS
- Premium_LRS
Show answer
C — Always pass --sku to avoid paying for RA-GRS.
Q3. Which is a valid storage account name?
- St-Saat
- stsaat48213
- st_saat
- s
Show answer
B — Lowercase letters and numbers, 3 to 24 characters.
Q4. An Owner gets AuthorizationPermissionMismatch listing blobs. Why?
- Wrong region
- No data-plane role
- Account is LRS
- TLS too old
Show answer
B — Owner is control plane; reading blobs needs a data role.
Q5. Does GRS protect against accidental deletion?
- Yes, always
- Only with RA-GRS
- No, deletes replicate
- Only in South India
Show answer
C — Use soft delete, versioning and backup for that.
Quick recap
Your storage account is set up and ready for the rest of this phase.
- StorageV2 is the default account type, and the premium types give one data type at SSD speed.
- LRS, ZRS, GRS and GZRS decide how many copies and where.
- Always pass
--sku, because the CLI default is RA-GRS. - Owner isn’t enough for data, so use the Storage Blob Data roles.
- Redundancy is not backup.
Next lesson
Lesson 22: Blob, File, Queue and Table storage: which one to use → Next you’ll put real data into all four services and see which job suits each one.
Further reading: Azure storage account
Want to go deeper into Azure storage account? See Microsoft’s Storage account overview and Azure Storage redundancy. You can also see the full plan for this course on the Azure Cloud Administration course page.
