Azure Storage architecture diagram showing storage accounts, blob containers, file shares, and access tiers

Azure Storage: Blob, Files & Security Configuration (AZ-104)

The short answer: an Azure storage account is the container for blobs, file shares, queues and tables. For almost everything you create a Standard general-purpose v2 account, pick a redundancy option (LRS, ZRS, GRS, GZRS, or the read-access RA- variants), keep blob data in the hot, cool, cold or archive tier according to how often it is read, and grant access with Microsoft Entra ID roles first and SAS tokens only where you must. When you do issue a SAS for a container or file share, tie it to a stored access policy so you can revoke it without rotating the account keys.

Storage is everywhere in Azure. VMs need disks. Applications need blob storage. Users need file shares. Logs need somewhere to go. It is also 15–20% of the AZ-104 exam and something you’ll work with in every Azure environment.

From the field: Azure Storage is deceptively complex. Most people start with blob storage and think that is all there is. In practice, I use tables for lightweight data, queues for async processing, and file shares for legacy lift-and-shift migrations. Understanding when to use which type saves both cost and headaches.

This post covers storage accounts, redundancy, Blob Storage and access tiers, Azure Files, SAS tokens and stored access policies, network security, data protection and AzCopy, with the Azure CLI and PowerShell for each. Commands follow the current Azure CLI and Az PowerShell reference on Microsoft Learn (checked 31 October 2026).

Career Impact

Why this matters: Storage is a large and easily ignored line on most cloud bills. Engineers who understand access tiers and lifecycle management can take a real chunk out of it, and engineers who understand SAS and network rules keep data from leaking.

CV value: describe the storage you actually designed or ran (redundancy chosen, lifecycle rules, SAS and private endpoint patterns), and only quote savings you measured.

Exam Coverage: Implement and Manage Storage (15–20%): configure access to storage (firewalls and virtual networks, SAS tokens, stored access policies, access keys, identity-based access for Azure Files), configure and manage storage accounts (redundancy, object replication, encryption, Storage Explorer and AzCopy), and configure Azure Files and Blob Storage (file shares, containers, tiers, snapshots and soft delete for Azure Files, lifecycle management, versioning). Source: AZ-104 study guide.

What You’ll Learn

  • Storage account types and which one to choose
  • Redundancy options, durability, and what failover really means
  • Blob Storage: containers, access tiers, rehydration and lifecycle management
  • Azure Files: SMB and NFS shares, mounting on Windows and Linux, snapshots and soft delete
  • SAS tokens, stored access policies (portal, CLI and Storage Explorer) and how to revoke access
  • Firewalls, private endpoints, encryption, versioning, immutability and object replication
  • AzCopy v10, plus the errors people actually hit and how to fix them

Quick Reference

Service Purpose Access Method
Blob Storage Unstructured data (files, images, backups, logs) HTTPS REST API, SDKs, AzCopy, Storage Explorer (NFS 3.0 and SFTP optional)
Azure Files Managed file shares SMB 3.x (all share types), NFS 4.1 (premium/SSD file shares only), FileREST
Queue Storage Message queuing between components HTTPS REST API, SDKs
Table Storage NoSQL key-value data HTTPS REST API (OData), SDKs
Managed Disks VM disks Attached to VMs (separate resource, not inside your storage account)

Each service has its own endpoint under the account name: https://<account>.blob.core.windows.net, .file.core.windows.net, .queue.core.windows.net, .table.core.windows.net, plus .dfs.core.windows.net for Data Lake Storage and .web.core.windows.net for static websites.

Storage Account Types

Account Types

Type (CLI --kind) Services Redundancy Use Case
Standard general-purpose v2 (StorageV2) Blob (including Data Lake Storage), Files, Queue, Table LRS, ZRS, GRS, RA-GRS, GZRS, RA-GZRS Most workloads. The default
Premium block blobs (BlockBlobStorage) Block and append blobs LRS, ZRS High transaction rates, small objects, consistently low latency
Premium file shares (FileStorage) Azure Files only LRS, ZRS High-performance shares, and the only type that supports NFS shares
Premium page blobs Page blobs only LRS (ZRS in some regions) Page blob workloads accessed over the REST API (unmanaged VM disks were retired on 31 March 2026; VMs now use managed disks)

Default choice: Standard general-purpose v2 (GPv2). You can’t change an account’s type after creation; to move, create a new account and copy the data. General-purpose v1 and legacy Blob Storage accounts are being retired, and both can be upgraded in place to GPv2 (one way only). Available redundancy also varies by region.

Performance Tiers

  • Standard: HDD-backed, cost-effective, the only performance tier for GPv2
  • Premium: SSD-backed, low latency and high throughput, with the dedicated account types above

Creating a Storage Account

If you leave out --sku, the CLI defaults to Standard_RAGRS, which is more than a lab needs, so set it. New accounts already default to HTTPS-only and to blocking anonymous blob access; the flags below make that explicit.

# Azure CLI - Create storage account
az storage account create \
  --name mystorageaccount$RANDOM \
  --resource-group az104-labs \
  --location uksouth \
  --sku Standard_LRS \
  --kind StorageV2 \
  --access-tier Hot \
  --min-tls-version TLS1_2 \
  --allow-blob-public-access false

# Check what you created
az storage account show \
  --name <account-name> \
  --resource-group az104-labs \
  --query "{name:name, kind:kind, sku:sku.name, tier:accessTier, httpsOnly:enableHttpsTrafficOnly}" \
  --output table

Example output of the show command (representative; your account name will differ):

Name                  Kind       Sku           Tier    HttpsOnly
--------------------  ---------  ------------  ------  -----------
mystorageaccount1234  StorageV2  Standard_LRS  Hot     True
# Azure PowerShell - Create storage account
New-AzStorageAccount -ResourceGroupName "az104-labs" `
  -Name "mystorageaccount$(Get-Random -Maximum 99999)" `
  -Location "uksouth" `
  -SkuName "Standard_LRS" `
  -Kind "StorageV2" `
  -AccessTier "Hot" `
  -MinimumTlsVersion "TLS1_2" `
  -AllowBlobPublicAccess $false

Naming rules:

  • 3–24 characters
  • Lowercase letters and numbers only
  • Globally unique across Azure (it becomes part of the endpoint DNS name)

Replication Options

Redundancy Levels

Option Where the copies live Durability (per year) Survives
LRS Three copies in a single datacentre in the primary region At least 11 nines Drive, server and rack failures
ZRS Copies synchronously across three or more availability zones in the primary region At least 12 nines Loss of a datacentre or zone, with reads and writes continuing
GRS LRS in the primary region, copied asynchronously to LRS in the paired secondary region At least 16 nines A regional disaster, after a failover
GZRS ZRS in the primary region, copied asynchronously to LRS in the secondary region At least 16 nines Zone loss without failover, and a regional disaster after failover

RA-GRS / RA-GZRS: with plain GRS or GZRS the secondary copy can’t be read until you fail over. The read-access variants let you read from a second endpoint at any time, which is the account name with -secondary appended (for example mystorageaccount-secondary.blob.core.windows.net). Azure Files doesn’t support the RA- variants.

Choosing Redundancy

Dev/test, data you can recreate:      LRS   (cheapest)
Production in one region:             ZRS   (zone failure, no remount for Azure Files)
Must survive a regional disaster:     GZRS  (or GRS where zones aren't available)
Need to read during a regional outage: RA-GZRS / RA-GRS

Two exam favourites: the archive tier is only supported on LRS, GRS and RA-GRS accounts, never ZRS, GZRS or RA-GZRS; and redundancy protects against hardware and site failure, not deletion. A deleted blob is deleted in every copy, which is what soft delete and versioning are for.

Failover

For GRS and GZRS accounts you can initiate a customer-managed failover. The CLI supports an unplanned failover (the default, for when the primary region is down) and a planned failover (for testing, with no data loss):

# Azure CLI - Initiate failover (Unplanned is the default)
az storage account failover \
  --name mystorageaccount \
  --resource-group az104-labs

# Planned failover, for DR testing
az storage account failover \
  --name mystorageaccount \
  --resource-group az104-labs \
  --failover-type Planned
# Azure PowerShell - Initiate failover
Invoke-AzStorageAccountFailover -ResourceGroupName "az104-labs" `
  -Name "mystorageaccount" -Force

Warning: replication to the secondary is asynchronous, so an unplanned failover can lose the most recent writes. The gap is your recovery point objective (RPO). Microsoft offers Geo priority replication, which commits to an RPO of 15 minutes or less for block blobs; without it, check the account’s Last sync time before you decide to fail over.

Blob Storage

Container and Blob Hierarchy

Storage Account
└── Container (like a top-level folder; access level is set here)
    └── Blob (the actual file)
        └── Virtual directories come from the name: folder/subfolder/file.txt

Creating a container with your Entra ID identity (--auth-mode login) is the method Microsoft recommends. Owner or Contributor on the account is not enough for data operations: assign yourself Storage Blob Data Contributor first, and allow a few minutes for the role to propagate.

# Give yourself data-plane access to the account
az ad signed-in-user show --query id -o tsv | az role assignment create \
  --role "Storage Blob Data Contributor" \
  --assignee @- \
  --scope "/subscriptions/<subscription-id>/resourceGroups/az104-labs/providers/Microsoft.Storage/storageAccounts/mystorageaccount"

# Create a private container using your Entra ID identity
az storage container create \
  --account-name mystorageaccount \
  --name backups \
  --auth-mode login

Blob Types

Type Purpose Max Size
Block blob Files, images, videos, backups About 190.7 TiB
Page blob Random read/write in 512-byte pages (VHD-style) 8 TiB
Append blob Logs, append-only data About 195 GiB

Access Tiers

Tier Storage cost Access cost Minimum retention Latency
Hot Highest Lowest None Milliseconds
Cool Lower Higher 30 days Milliseconds
Cold Lower still Higher still 90 days Milliseconds
Archive Lowest Highest 180 days Hours (offline)

Rules that come up in the exam and in real bills:

  • Tiers apply to block blobs only, not append or page blobs.
  • Deleting, overwriting or moving a blob out of cool, cold or archive before its minimum period triggers a prorated early deletion charge (archive a blob, delete it after 45 days, and you pay for the remaining 135).
  • The account default tier can be hot, cool or cold, never archive. Blobs without an explicit tier show as “Hot (inferred)” and change if you change the default.
  • Archive is offline. You must rehydrate a blob to an online tier before reading it, which can take up to 15 hours at standard priority (high priority is faster and costs more). Lifecycle policies can’t rehydrate.
  • Archive isn’t available on ZRS, GZRS or RA-GZRS accounts.

Setting Blob Tier

# Azure CLI - Upload a blob straight into the Cool tier
az storage blob upload \
  --account-name mystorageaccount \
  --container-name backups \
  --name archive/backup-2026.zip \
  --file ./backup.zip \
  --tier Cool \
  --auth-mode login

# Azure CLI - Move an existing blob to Archive (LRS/GRS/RA-GRS accounts only)
az storage blob set-tier \
  --account-name mystorageaccount \
  --container-name backups \
  --name archive/old-backup.zip \
  --tier Archive \
  --auth-mode login

# Azure CLI - Rehydrate it to Hot with high priority
az storage blob set-tier \
  --account-name mystorageaccount \
  --container-name backups \
  --name archive/old-backup.zip \
  --tier Hot \
  --rehydrate-priority High \
  --auth-mode login
# Azure PowerShell - Upload blob to specific tier
$Context = (Get-AzStorageAccount -ResourceGroupName "az104-labs" -Name "mystorageaccount").Context
Set-AzStorageBlobContent -File "./backup.zip" -Container "backups" `
  -Blob "archive/backup-2026.zip" -Context $Context -StandardBlobTier Cool

# Azure PowerShell - Change existing blob tier
$Blob = Get-AzStorageBlob -Container "backups" -Blob "archive/old-backup.zip" -Context $Context
$Blob.BlobClient.SetAccessTier("Archive")

Lifecycle Management

Lifecycle management moves or deletes blobs automatically on a schedule you define. This policy moves backups to cool after 30 days, archive after 90 and deletes them after a year:

{
  "rules": [
    {
      "name": "moveOldBackups",
      "enabled": true,
      "type": "Lifecycle",
      "definition": {
        "filters": {
          "blobTypes": ["blockBlob"],
          "prefixMatch": ["backups/"]
        },
        "actions": {
          "baseBlob": {
            "tierToCool": { "daysAfterModificationGreaterThan": 30 },
            "tierToArchive": { "daysAfterModificationGreaterThan": 90 },
            "delete": { "daysAfterModificationGreaterThan": 365 }
          }
        }
      }
    }
  ]
}
# Azure CLI - Apply lifecycle policy
az storage account management-policy create \
  --account-name mystorageaccount \
  --resource-group az104-labs \
  --policy @lifecycle-policy.json
# Azure PowerShell - Apply lifecycle policy
# (the cmdlet takes rule objects, not a JSON file; this builds the same rule)
$Action = Add-AzStorageAccountManagementPolicyAction -BaseBlobAction TierToCool -DaysAfterModificationGreaterThan 30
$Action = Add-AzStorageAccountManagementPolicyAction -InputObject $Action -BaseBlobAction TierToArchive -DaysAfterModificationGreaterThan 90
$Action = Add-AzStorageAccountManagementPolicyAction -InputObject $Action -BaseBlobAction Delete -DaysAfterModificationGreaterThan 365
$Filter = New-AzStorageAccountManagementPolicyFilter -PrefixMatch "backups/" -BlobType blockBlob
$Rule = New-AzStorageAccountManagementPolicyRule -Name "moveOldBackups" -Action $Action -Filter $Filter
Set-AzStorageAccountManagementPolicy -ResourceGroupName "az104-labs" `
  -StorageAccountName "mystorageaccount" -Rule $Rule

Azure Files

What Azure Files Does

Managed file shares in the cloud:

  • Mount over SMB from Windows, Linux and macOS (NFS 4.1 on premium shares for Linux)
  • Replace or extend on-premises file servers
  • Lift-and-shift applications that expect a file path
  • Azure File Sync to cache shares on Windows Server for hybrid use

Creating a File Share

az storage share-rm manages shares through the Microsoft.Storage resource provider, so it works with your Azure role and doesn’t need the account key. On a GPv2 account the share tier can be TransactionOptimized (the default), Hot or Cool; premium (FileStorage) accounts use Premium. Share names are 3–63 characters: lowercase letters, numbers and single hyphens.

# Azure CLI - Create a 100 GiB SMB file share
az storage share-rm create \
  --resource-group az104-labs \
  --storage-account mystorageaccount \
  --name myshare \
  --quota 100 \
  --access-tier TransactionOptimized \
  --enabled-protocols SMB

# Azure CLI - Upload a file (data-plane command; without other auth options the
# CLI looks up the account key using your Azure login)
az storage file upload \
  --account-name mystorageaccount \
  --share-name myshare \
  --source ./document.pdf
# Azure PowerShell - Create file share
New-AzRmStorageShare -ResourceGroupName "az104-labs" -StorageAccountName "mystorageaccount" `
  -Name "myshare" -QuotaGiB 100

# Azure PowerShell - Upload file
$Context = (Get-AzStorageAccount -ResourceGroupName "az104-labs" -Name "mystorageaccount").Context
Set-AzStorageFileContent -ShareName "myshare" -Source "./document.pdf" -Context $Context

Mounting on Windows

SMB uses TCP port 445, which many home ISPs and corporate networks block outbound. Test it before anything else. The Connect button on the share in the portal generates the same script as below.

# 1. Can you reach port 445?
Test-NetConnection -ComputerName mystorageaccount.file.core.windows.net -Port 445
# You want: TcpTestSucceeded : True

# 2. Store the credential (username is localhost\<account>, password is the account key)
$storageKey = (Get-AzStorageAccountKey -ResourceGroupName "az104-labs" -Name "mystorageaccount")[0].Value
cmd.exe /C "cmdkey /add:`"mystorageaccount.file.core.windows.net`" /user:`"localhost\mystorageaccount`" /pass:`"$storageKey`""

# 3. Map the drive
New-PSDrive -Name Z -PSProvider FileSystem -Root "\\mystorageaccount.file.core.windows.net\myshare" -Persist

Mounting on Linux

Microsoft’s current guidance: install cifs-utils, check port 445, keep the key in a root-only credentials file rather than on the command line, and use SMB 3.1.1 (the default from Linux kernel 5.0).

# Install CIFS utilities (Ubuntu/Debian)
sudo apt update && sudo apt install cifs-utils

# Check port 445
nc -zvw3 mystorageaccount.file.core.windows.net 445
# You want: Connection to mystorageaccount.file.core.windows.net 445 port [tcp/microsoft-ds] succeeded!

# Credentials file, readable by root only
sudo mkdir -p /etc/smbcredentials
echo "username=mystorageaccount" | sudo tee /etc/smbcredentials/mystorageaccount.cred > /dev/null
echo "password=<storage-account-key>" | sudo tee -a /etc/smbcredentials/mystorageaccount.cred > /dev/null
sudo chmod 600 /etc/smbcredentials/mystorageaccount.cred

# Mount
sudo mkdir -p /mnt/azure/myshare
sudo mount -t cifs //mystorageaccount.file.core.windows.net/myshare /mnt/azure/myshare \
  -o credentials=/etc/smbcredentials/mystorageaccount.cred,serverino,nosharesock,actimeo=30,mfsymlinks

# Persistent mount: add to /etc/fstab
//mystorageaccount.file.core.windows.net/myshare /mnt/azure/myshare cifs _netdev,nofail,credentials=/etc/smbcredentials/mystorageaccount.cred,serverino,nosharesock,actimeo=30,mfsymlinks 0 0

The account key gives full control of the whole account, so for anything beyond a lab use identity-based access: Azure Files supports on-premises AD DS, Microsoft Entra Domain Services and Microsoft Entra Kerberos (for hybrid identities). Share-level access then comes from the RBAC roles Storage File Data SMB Share Reader, Contributor and Elevated Contributor, with NTFS permissions on files and folders on top.

Snapshots and Soft Delete for Azure Files

Share soft delete keeps a deleted share recoverable for the retention period; share snapshots are read-only, point-in-time copies of a whole share that you can browse and restore files from (Windows shows them as Previous Versions).

# Enable soft delete for file shares (14 days)
az storage account file-service-properties update \
  --resource-group az104-labs \
  --account-name mystorageaccount \
  --enable-delete-retention true \
  --delete-retention-days 14

# Take a share snapshot (this share-rm command is marked preview in the CLI reference)
az storage share-rm snapshot \
  --resource-group az104-labs \
  --storage-account mystorageaccount \
  --name myshare

# Find a deleted share and restore it
az storage share-rm list --storage-account mystorageaccount --include-deleted
az storage share-rm restore \
  --resource-group az104-labs \
  --storage-account mystorageaccount \
  --name myshare \
  --deleted-version <version-from-list>

Azure File Sync

Sync on-premises Windows file servers with Azure Files:

  • Cache frequently accessed files locally
  • Cloud tiering frees local space
  • Multi-site sync
  • Backup integration

Components:

  • Storage Sync Service
  • Sync Group
  • Registered Server
  • Cloud Endpoint (Azure Files)
  • Server Endpoint (local folder)

Storage Security

Authentication Methods

Method Use Case
Microsoft Entra ID + RBAC The recommended default for users, apps and managed identities
Storage Account Key (Shared Key) Full access to everything in the account. Rotate the two keys, and consider disallowing Shared Key entirely (--allow-shared-key-access false)
SAS Token Delegated, time-limited access for clients that can’t use Entra ID
Anonymous Public read of a container. Blocked by default on new accounts

Shared Access Signatures (SAS)

A SAS is a signed set of query parameters appended to a resource URL that grants limited access without sharing the account key. There are three types:

Type Signed with Scope Stored access policy?
User delegation SAS A user delegation key from Microsoft Entra ID Blob (and Data Lake), Queue, Table, Files No. Valid for at most 7 days
Service SAS The account key One service Yes
Account SAS The account key One or more services, including service-level operations No

Microsoft recommends a user delegation SAS wherever you can use one. Two facts are worth knowing before you issue any SAS: Azure doesn’t track or audit SAS generation, and an ad hoc SAS signed with the account key can only be revoked by rotating that key. A stored access policy or a user delegation SAS gives you a cleaner way out.

# Azure CLI - User delegation SAS for one blob (recommended)
# Needs a role with generateUserDelegationKey, e.g. Storage Blob Data Contributor
end_date=$(date -u -d "1 day" '+%Y-%m-%dT%H:%MZ')

az storage blob generate-sas \
  --account-name mystorageaccount \
  --container-name uploads \
  --name document.pdf \
  --permissions r \
  --expiry $end_date \
  --https-only \
  --auth-mode login \
  --as-user \
  --full-uri

# Revoke every user delegation SAS on the account
az storage account revoke-delegation-keys \
  --name mystorageaccount \
  --resource-group az104-labs
# Azure PowerShell - Service SAS for one blob (signed with the account key)
$Context = (Get-AzStorageAccount -ResourceGroupName "az104-labs" -Name "mystorageaccount").Context
$EndTime = (Get-Date).AddDays(1)

New-AzStorageBlobSASToken -Container "uploads" -Blob "document.pdf" `
  -Context $Context -Permission r -ExpiryTime $EndTime -Protocol HttpsOnly

SAS URL format (the CLI returns the token without the leading ?; add it when you build the URL yourself):

https://mystorageaccount.blob.core.windows.net/container/blob?sv=...&se=...&sp=r&spr=https&sig=...

sp is permissions, st/se the start and expiry, spr the allowed protocol, sig the signature, and si the stored access policy name when one is used.

Stored Access Policies

A stored access policy lives on the container, file share, queue or table and holds a SAS’s start time, expiry and permissions on the server side. A service SAS that references it (by its identifier) inherits those values, so you can shorten, change or revoke every SAS tied to the policy in one move, without touching the account keys.

  • Up to five stored access policies per container, share, queue or table; a sixth returns 400 Bad Request.
  • Only service SAS tokens can use them. User delegation and account SAS can’t.
  • Set start, expiry and permissions either on the policy or on the SAS, not both.
  • Changes can take up to 30 seconds to apply. During that window, requests using an associated SAS can fail with 403 Forbidden.
  • To revoke: delete the policy, rename it (change its identifier), or set its expiry to a time in the past.

In the Azure portal (blob container): open the storage account > Data storage > Containers > select the container > Access policy. Under Stored access policies select Add policy, give it an identifier, choose permissions, set start and expiry, then OK and Save.

For a file share: Microsoft documents two routes. In Azure Storage Explorer, right-click the share and choose Manage Access Policies, then Add. From the CLI, use az storage share policy, shown below. If the portal’s view of your share doesn’t offer an access policy option, either of these does the same job.

# --- Blob container ---
# Create a read-only stored access policy valid for 30 days
az storage container policy create \
  --account-name mystorageaccount \
  --container-name uploads \
  --name readpolicy \
  --permissions r \
  --expiry $(date -u -d "30 days" '+%Y-%m-%dT%H:%MZ')

# Generate a service SAS that uses the policy (no permissions/expiry on the SAS itself)
az storage blob generate-sas \
  --account-name mystorageaccount \
  --container-name uploads \
  --name document.pdf \
  --policy-name readpolicy \
  --full-uri

# --- File share ---
# Permissions for share policies: (c)reate (d)elete (l)ist (r)ead (w)rite
az storage share policy create \
  --account-name mystorageaccount \
  --share-name myshare \
  --name sharereadpolicy \
  --permissions rl \
  --expiry $(date -u -d "30 days" '+%Y-%m-%dT%H:%M:%SZ')

az storage share policy list --account-name mystorageaccount --share-name myshare --output table

# Service SAS for the share, bound to the policy
az storage share generate-sas \
  --account-name mystorageaccount \
  --name myshare \
  --policy-name sharereadpolicy

# Revoke every SAS issued against the policy
az storage share policy delete \
  --account-name mystorageaccount \
  --share-name myshare \
  --name sharereadpolicy
# Azure PowerShell - Stored access policy on a container
$Context = (Get-AzStorageAccount -ResourceGroupName "az104-labs" -Name "mystorageaccount").Context
New-AzStorageContainerStoredAccessPolicy -Container "uploads" -Policy "readpolicy" `
  -Context $Context -Permission r -ExpiryTime (Get-Date).AddDays(30)

# Generate SAS using policy
New-AzStorageBlobSASToken -Container "uploads" -Blob "document.pdf" `
  -Context $Context -Policy "readpolicy"

# Stored access policy on a file share
New-AzStorageShareStoredAccessPolicy -ShareName "myshare" -Policy "sharereadpolicy" `
  -Context $Context -Permission rl -ExpiryTime (Get-Date).AddDays(30)

The share policy commands are data-plane operations signed with the account key, so they need an account where Shared Key access is allowed. That is the trade-off: stored access policies only exist for key-signed (service) SAS. Microsoft also recommends a SAS expiration policy on the account, which warns (and logs) when someone issues a service or account SAS valid for longer than the interval you set.

Encryption

At rest:

  • All data is encrypted automatically with 256-bit AES; you can’t turn it off
  • Microsoft-managed keys by default
  • Customer-managed keys in Azure Key Vault or Managed HSM when compliance requires it
  • Optional infrastructure encryption (a second layer) chosen at account creation, and encryption scopes for per-container or per-blob keys

In transit:

  • Secure transfer required (HTTPS only) is on by default for new accounts
  • Set the minimum TLS version to 1.2
# Azure CLI - Require HTTPS and TLS 1.2 on an existing account
az storage account update \
  --name mystorageaccount \
  --resource-group az104-labs \
  --https-only true \
  --min-tls-version TLS1_2
# Azure PowerShell - Require HTTPS and TLS 1.2
Set-AzStorageAccount -ResourceGroupName "az104-labs" -Name "mystorageaccount" `
  -EnableHttpsTrafficOnly $true -MinimumTlsVersion TLS1_2

Network Security

Firewall rules: allow a subnet (which needs the Microsoft.Storage service endpoint enabled first) or a public IP, then set the default action to Deny. Do it in that order or you lock yourself out.

# Azure CLI - Enable the service endpoint on the subnet
az network vnet subnet update \
  --resource-group az104-labs \
  --vnet-name MyVNet \
  --name DataSubnet \
  --service-endpoints Microsoft.Storage

# Allow that subnet and your own public IP
az storage account network-rule add \
  --account-name mystorageaccount \
  --resource-group az104-labs \
  --vnet-name MyVNet \
  --subnet DataSubnet

az storage account network-rule add \
  --account-name mystorageaccount \
  --resource-group az104-labs \
  --ip-address 203.0.113.10

# Then set default action to deny
az storage account update \
  --name mystorageaccount \
  --resource-group az104-labs \
  --default-action Deny
# Azure PowerShell - Allow only specific VNet
$VNet = Get-AzVirtualNetwork -Name "MyVNet" -ResourceGroupName "az104-labs"
$Subnet = Get-AzVirtualNetworkSubnetConfig -Name "DataSubnet" -VirtualNetwork $VNet
Add-AzStorageAccountNetworkRule -ResourceGroupName "az104-labs" -Name "mystorageaccount" `
  -VirtualNetworkResourceId $Subnet.Id

# Set default action to deny
Update-AzStorageAccountNetworkRuleSet -ResourceGroupName "az104-labs" `
  -Name "mystorageaccount" -DefaultAction Deny

Private endpoints: give the storage service a private IP in your VNet, one endpoint per sub-resource (blob, file, queue, table, dfs, web). Clients also need DNS to resolve the account name to that private IP, normally through a private DNS zone such as privatelink.blob.core.windows.net linked to the VNet.

# Azure CLI - Create private endpoint for blob
az network private-endpoint create \
  --name StorageEndpoint \
  --resource-group az104-labs \
  --vnet-name MyVNet \
  --subnet DataSubnet \
  --private-connection-resource-id $(az storage account show -n mystorageaccount -g az104-labs --query id -o tsv) \
  --group-id blob \
  --connection-name StorageConnection
# Azure PowerShell - Create private endpoint
$StorageAccount = Get-AzStorageAccount -ResourceGroupName "az104-labs" -Name "mystorageaccount"
$VNet = Get-AzVirtualNetwork -Name "MyVNet" -ResourceGroupName "az104-labs"
$Subnet = Get-AzVirtualNetworkSubnetConfig -Name "DataSubnet" -VirtualNetwork $VNet

$Connection = New-AzPrivateLinkServiceConnection -Name "StorageConnection" `
  -PrivateLinkServiceId $StorageAccount.Id -GroupId "blob"

New-AzPrivateEndpoint -Name "StorageEndpoint" -ResourceGroupName "az104-labs" `
  -Location "uksouth" -Subnet $Subnet -PrivateLinkServiceConnection $Connection

Data Protection

Soft Delete

Blob soft delete and container soft delete are separate settings. Turn on both:

# Azure CLI - Enable blob and container soft delete
az storage account blob-service-properties update \
  --account-name mystorageaccount \
  --resource-group az104-labs \
  --enable-delete-retention true \
  --delete-retention-days 14 \
  --enable-container-delete-retention true \
  --container-delete-retention-days 14
# Azure PowerShell - Enable soft delete for blobs
Enable-AzStorageBlobDeleteRetentionPolicy -ResourceGroupName "az104-labs" `
  -StorageAccountName "mystorageaccount" -RetentionDays 14

Versioning

Versioning keeps the previous version of a blob every time it is overwritten or deleted:

# Azure CLI - Enable versioning
az storage account blob-service-properties update \
  --account-name mystorageaccount \
  --resource-group az104-labs \
  --enable-versioning true
# Azure PowerShell - Enable versioning
Update-AzStorageBlobServiceProperty -ResourceGroupName "az104-labs" `
  -StorageAccountName "mystorageaccount" -IsVersioningEnabled $true

Object Replication

Object replication copies block blobs asynchronously from a container in one account to a container in another (any region). It requires blob versioning on both accounts and change feed on the source, and isn’t supported on accounts with a hierarchical namespace. You create the policy on the destination account first, then apply the same policy to the source:

# Prerequisites
az storage account blob-service-properties update \
  --resource-group az104-labs --account-name srcaccount \
  --enable-versioning --enable-change-feed
az storage account blob-service-properties update \
  --resource-group az104-labs --account-name destaccount \
  --enable-versioning

# Policy on the destination account
az storage account or-policy create \
  --account-name destaccount \
  --resource-group az104-labs \
  --source-account srcaccount \
  --destination-account destaccount \
  --source-container source-container-1 \
  --destination-container dest-container-1

# Copy the same policy (same policy ID) to the source account
az storage account or-policy show \
  --resource-group az104-labs --account-name destaccount --policy-id <policy-id> |
  az storage account or-policy create --resource-group az104-labs \
  --account-name srcaccount --policy "@-"

Immutable Storage

WORM (Write Once, Read Many) for compliance:

  • Time-based retention: blobs can’t be modified or deleted until the period expires. Once the policy is locked it can only be extended, never shortened or removed
  • Legal hold: blobs can’t be modified or deleted while the hold is in place
# Azure CLI - Set an (unlocked) 365-day retention policy on a container
az storage container immutability-policy create \
  --resource-group az104-labs \
  --account-name mystorageaccount \
  --container-name compliance \
  --period 365
# Azure PowerShell - Set retention policy
Set-AzRmStorageContainerImmutabilityPolicy -ResourceGroupName "az104-labs" `
  -StorageAccountName "mystorageaccount" -ContainerName "compliance" `
  -ImmutabilityPeriod 365

Moving Data with AzCopy v10

AzCopy v10 is the supported version and is on the AZ-104 skills list alongside Azure Storage Explorer. On Linux, install it from Microsoft’s package repository or download the portable binary (aka.ms/downloadazcopy-v10-linux); on Windows and macOS it is a portable binary. Authorise with Microsoft Entra ID (your account needs a data role such as Storage Blob Data Contributor, as above) or append a SAS token to the URL. From v10.34.0 AzCopy collects usage telemetry; add --disable-telemetry=true to opt out.

# Sign in with Microsoft Entra ID
azcopy login --tenant-id <tenant-id>

# Upload a local folder to a container
azcopy copy './backups' 'https://mystorageaccount.blob.core.windows.net/backups' --recursive

# Keep a container in step with a local folder (only copies what changed)
azcopy sync './site' 'https://mystorageaccount.blob.core.windows.net/site' --recursive

# Copy into an Azure file share using a SAS token instead of a login
azcopy copy './reports' 'https://mystorageaccount.file.core.windows.net/myshare/reports?<SAS-token>' --recursive

# List what is in a container
azcopy list 'https://mystorageaccount.blob.core.windows.net/backups'

Practice Lab: Complete Storage Setup

This lab uses LRS so that the archive tier works. Delete the resource group afterwards.

# Azure CLI - Complete storage setup
STORAGE_NAME="azlabstore$RANDOM"
RG="az104-labs"

# Storage account
az storage account create \
  --name $STORAGE_NAME \
  --resource-group $RG \
  --location uksouth \
  --sku Standard_LRS \
  --kind StorageV2 \
  --access-tier Hot \
  --min-tls-version TLS1_2 \
  --allow-blob-public-access false

# Data-plane role for yourself (wait a few minutes after this)
az ad signed-in-user show --query id -o tsv | az role assignment create \
  --role "Storage Blob Data Contributor" \
  --assignee @- \
  --scope $(az storage account show -n $STORAGE_NAME -g $RG --query id -o tsv)

# Containers
az storage container create --account-name $STORAGE_NAME --name uploads --auth-mode login
az storage container create --account-name $STORAGE_NAME --name backups --auth-mode login

# Upload a test file
echo "Test content" > testfile.txt
az storage blob upload \
  --account-name $STORAGE_NAME \
  --container-name uploads \
  --name testfile.txt \
  --file testfile.txt \
  --auth-mode login

# File share
az storage share-rm create --resource-group $RG --storage-account $STORAGE_NAME --name documents --quota 50

# Soft delete for blobs, containers and file shares
az storage account blob-service-properties update \
  --account-name $STORAGE_NAME --resource-group $RG \
  --enable-delete-retention true --delete-retention-days 7 \
  --enable-container-delete-retention true --container-delete-retention-days 7
az storage account file-service-properties update \
  --account-name $STORAGE_NAME --resource-group $RG \
  --enable-delete-retention true --delete-retention-days 7

# Stored access policy and a SAS bound to it
az storage container policy create --account-name $STORAGE_NAME --container-name uploads \
  --name labread --permissions r --expiry $(date -u -d "1 day" '+%Y-%m-%dT%H:%MZ')
az storage blob generate-sas --account-name $STORAGE_NAME --container-name uploads \
  --name testfile.txt --policy-name labread --full-uri

# Clean up the local file
rm testfile.txt

# When finished: delete everything
# az group delete --name $RG --yes --no-wait
# Azure PowerShell - Complete storage setup
$StorageName = "azlabstore$(Get-Random -Maximum 99999)"
$StorageAccount = New-AzStorageAccount -ResourceGroupName "az104-labs" `
  -Name $StorageName -Location "uksouth" -SkuName "Standard_LRS" `
  -Kind "StorageV2" -AccessTier "Hot" -EnableHttpsTrafficOnly $true `
  -MinimumTlsVersion TLS1_2 -AllowBlobPublicAccess $false

$Context = $StorageAccount.Context

# Create containers
New-AzStorageContainer -Name "uploads" -Context $Context -Permission Off
New-AzStorageContainer -Name "backups" -Context $Context -Permission Off

# Upload test file
"Test content" | Out-File -FilePath "testfile.txt"
Set-AzStorageBlobContent -File "testfile.txt" -Container "uploads" `
  -Blob "testfile.txt" -Context $Context

# Create file share
New-AzRmStorageShare -ResourceGroupName "az104-labs" -StorageAccountName $StorageName `
  -Name "documents" -QuotaGiB 50

# Enable soft delete
Enable-AzStorageBlobDeleteRetentionPolicy -ResourceGroupName "az104-labs" `
  -StorageAccountName $StorageName -RetentionDays 7

# Clean up test file
Remove-Item "testfile.txt"

Troubleshooting Azure Storage

Error Cause Fix
AuthorizationPermissionMismatch: “This request is not authorized to perform this operation using this permission” You used --auth-mode login (or AzCopy with Entra ID) but only have management roles such as Owner or Contributor Assign a data role (Storage Blob Data Reader/Contributor) at account or container scope and wait a few minutes
AuthorizationFailure: “This request is not authorized to perform this operation” The storage firewall is blocking your IP or network Add your public IP or subnet under Networking, or connect through the private endpoint
AuthenticationFailed: “Server failed to authenticate the request” with a SAS Expired or not-yet-valid SAS (clock skew), wrong permissions, a deleted stored access policy, or a regenerated account key Set the start time 15 minutes in the past or leave it out, check sp and se, reissue the SAS
403 straight after creating or editing a stored access policy Policy changes take up to 30 seconds to apply Wait and retry
400 Bad Request adding a policy The container or share already has five stored access policies Delete or reuse an existing policy
PublicAccessNotPermitted creating a public container Anonymous blob access is disabled on the account (the default for new accounts) Keep it private and use SAS, or deliberately set --allow-blob-public-access true on the account first
BlobArchived: “This operation is not permitted on an archived blob” The blob is in the archive tier Rehydrate with az storage blob set-tier --tier Hot --rehydrate-priority Standard (or High) and wait
Windows: “System error 53 has occurred. The network path was not found” or System error 67 Outbound TCP 445 blocked by your ISP or firewall (or NTLMv1 enabled on the client) Test-NetConnection -Port 445; use a VPN, ExpressRoute or Azure File Sync if 445 can’t be opened
Windows: “System error 5 has occurred. Access is denied” Unencrypted SMB from outside the datacentre, or firewall rules on the account Use a client that supports SMB 3.x encryption; check the account’s network rules
Linux: mount error(13): Permission denied No SMB encryption on the client, wrong key, storage firewall blocking the client, or port 445 blocked Use a current kernel and cifs-utils, check the credentials file, allow the client in Networking, test 445 with nc
Linux: mount error(112): Host is down The client was idle a long time and the connection timed out Remount; keep the share in use or reconnect on demand with autofs

Sources: Troubleshoot Azure Files SMB connectivity, Define a stored access policy, SAS overview, Blob Storage error codes.

Interview Questions

Q1: “Explain Azure Storage access tiers and when you’d use each.”

Good Answer: “Hot for data in active use: highest storage cost, lowest access cost. Cool for data read rarely but needed instantly, with a 30-day minimum. Cold for data read even less, 90-day minimum. Archive is offline with a 180-day minimum and takes hours to rehydrate, so it suits compliance copies. I’d use hot for live application data, cool or cold for recent backups and archive for long-term retention, with a lifecycle policy moving data down by age. I’d also check the redundancy first, because archive doesn’t work on ZRS or GZRS accounts.”

Q2: “How would you secure a storage account?”

Good Answer: “Layer it. Keep anonymous access off and use Entra ID with data-plane RBAC roles instead of account keys, ideally disallowing Shared Key. Use private endpoints with private DNS, or at least firewall rules with a default deny. Keep HTTPS-only and TLS 1.2. Where a SAS is unavoidable, prefer user delegation SAS with short expiry, or bind service SAS to stored access policies so they can be revoked. Turn on soft delete and versioning, Defender for Storage for threat detection, and customer-managed keys only if compliance needs them.”

Q3: “A team needs to share large files with external partners. How would you set this up?”

Good Answer: “A dedicated container per partner. If the partner can’t sign in with Entra ID B2B, issue a service SAS bound to a stored access policy on that container: read-only if they only download, write or create if they upload, with an expiry measured in days. When the engagement ends, delete the policy and every SAS stops working without touching the account keys. I’d log access through Azure Monitor and use AzCopy or Storage Explorer for the large transfers.”

Key Exam Points

Topic Remember
Account type GPv2 is the default; type can’t be changed later; NFS shares need premium file shares
Redundancy LRS 11 nines, ZRS 12, GRS/GZRS 16; RA- adds a readable -secondary endpoint; Azure Files has no RA- option
Tiers Hot / cool 30 days / cold 90 days / archive 180 days; block blobs only; archive is offline and not on ZRS/GZRS
Default tier Hot, cool or cold; never archive
SAS types User delegation (Entra ID, max 7 days, recommended), service (key, can use a stored access policy), account (key)
Stored access policies Max five per container/share/queue/table; up to 30 seconds to apply; revoke by delete, rename or past expiry
Soft delete Blob, container and file share soft delete are separate settings
Object replication Versioning on both accounts, change feed on the source
Network Private endpoints give a private IP and need private DNS; service endpoints keep the public endpoint but restrict by subnet
Data access Owner/Contributor manage the account; data access needs Storage Blob/File Data roles
Unmanaged disks Retired 31 March 2026; VMs use managed disks

Career Application

On your CV: list the storage work you have genuinely done (lifecycle policies, SAS and private endpoint access patterns, file share migrations with Azure File Sync) and only quote volumes or savings you can back up.

Demonstrate:

  • Cost optimisation awareness
  • Security-first thinking
  • Understanding of data lifecycle
  • Hybrid storage knowledge

Next Steps

Next in series: This completes the 4-part Azure Administrator series

Related: Terraform Fundamentals – Automate storage deployment

Lab: Create storage account with lifecycle policy and private endpoint

Storage seems simple until you’re paying for hot tier on data nobody has accessed in a year. Design your storage strategy before you need it.

Related Guides

If you found this useful, these guides continue the journey:

The RTM Essential Stack - Gear I Actually Use

Frequently Asked Questions

What are the different Azure storage account types?

Microsoft recommends four: Standard general-purpose v2 (the default, supporting blobs, files, queues and tables with every redundancy option), Premium block blobs, Premium file shares (the only type that supports NFS shares) and Premium page blobs. Premium types use SSDs and support LRS and ZRS. General-purpose v1 and legacy Blob Storage accounts are being retired and can be upgraded to GPv2.

What is the difference between Azure Blob, Files, and Disk storage?

Blob storage is for unstructured data like images, backups, and logs accessed via HTTP. Azure Files provides SMB/NFS file shares mountable by VMs and on-premises servers. Azure Disk storage provides block-level volumes attached directly to VMs as their OS or data drives. Each serves a different access pattern.

How does Azure storage redundancy work?

LRS keeps three copies in one datacentre (at least 11 nines durability). ZRS copies data synchronously across three or more availability zones (12 nines). GRS and GZRS add an asynchronous copy in the paired secondary region (16 nines), and the RA- variants let you read from the secondary at any time. Because geo-replication is asynchronous, an unplanned failover can lose the most recent writes.

What is a Shared Access Signature (SAS) token in Azure?

A SAS token grants limited, time-bound access to Azure storage resources without sharing account keys. You can restrict it by service, resource, permissions, IP range, protocol and expiry. There are three types: user delegation SAS (signed with Microsoft Entra ID credentials, valid for up to seven days and recommended by Microsoft), service SAS and account SAS (both signed with the account key).

What is a stored access policy in Azure Storage?

A stored access policy is a server-side set of start time, expiry and permissions on a blob container, file share, queue or table. A service SAS that references it inherits those settings, so you can change or revoke every SAS tied to the policy by editing or deleting it, without rotating account keys. Each resource can have up to five, changes can take up to 30 seconds to apply, and user delegation or account SAS can’t use them.

How do I create a stored access policy for an Azure file share?

Use Azure Storage Explorer (right-click the share, Manage Access Policies, Add) or the Azure CLI command az storage share policy create with the account name, share name, a policy name, permissions such as rl and an expiry time. Then generate a SAS with az storage share generate-sas and the policy name. For a blob container the Azure portal route is the container’s Access policy page, Add policy.

How do I secure an Azure storage account?

Keep anonymous blob access disabled, use Microsoft Entra ID with data-plane RBAC roles instead of account keys where possible, use private endpoints or firewall rules with a default deny, require HTTPS with TLS 1.2, prefer short-lived user delegation SAS or stored access policies over long-lived SAS, enable soft delete and versioning, and turn on Microsoft Defender for Storage for threat detection.

Enjoyed this guide?

New articles on Linux, homelab, cloud, and automation every 2 days. No spam, unsubscribe anytime.

Scroll to Top