Securing access to storage

AZ-104 Azure AdministratorStorageAbout 25 minutesBy Cloud Hands On

Pick the right way to grant access, from access keys to SAS tokens to Entra ID, then lock the network down with the storage firewall.

In this lesson you'll learn

1. The ways to say "yes, you may"

New to storage security? Start here

Every request to a storage account must be authorised. Think of the options as keys to a building. An access key is the master key to every room. A SAS token is a visitor badge for certain rooms that expires at a set time. Entra ID with RBAC is your staff ID card, checked against a list of what you are allowed to do.

Access methods from least to most secure: access key, account and service SAS, user delegation SAS, Entra ID with RBAC and managed identity Less secureMore secure Access keyFull controlNever expiresA secret Account orservice SASLimited, expiresSigned by a key User delegationSASSigned withEntra credentials Entra ID + RBACManaged identityNo secrets at allAuditable
Prefer the right-hand side whenever the app supports it.

2. Access keys

Every account has two access keys, so you can rotate one while apps use the other.

  1. Switch apps to key2.
  2. Regenerate key1.
  3. Switch apps back to key1.
  4. Regenerate key2.

Better still, store keys in Key Vault with automatic rotation, or set Allow storage account key access to Disabled so only Entra ID works.

3. Shared access signatures

A SAS is a token appended to a URL. It says which service, which permissions (read, write, delete, list), which IPs, which protocol and for how long.

SAS typeSigned withCovers
User delegation SASEntra ID credentialsBlob storage only. The most secure type.
Service SASAccount keyOne service (blob, file, queue or table)
Account SASAccount keyOne or more services, including service-level operations
Revoking a SAS: an ad-hoc SAS can only be revoked by regenerating the key that signed it, which breaks everything else using that key. Link service SAS tokens to a stored access policy instead, and you can revoke them by changing or deleting the policy. Up to five policies per container, share, queue or table.

Example

SS Kaiser's accountants need to upload year-end files for 30 days. The team creates a stored access policy on the year-end container with write permission and a 30-day expiry, then issues a service SAS linked to it. When one accountant leaves early, deleting the policy revokes every token at once, without touching the account keys.

4. Entra ID and managed identities

Apps running in Azure (VMs, App Service, Functions) can use a managed identity. Grant it a data role on the storage account, and the app reads data with no secrets in its code.

NeedRole
Read blobsStorage Blob Data Reader
Read, write and delete blobsStorage Blob Data Contributor
Full blob control including ACLsStorage Blob Data Owner
Process queue messagesStorage Queue Data Contributor

Exam focus

"Minimise secrets" means managed identity plus a data role. "Access for a limited time" means a SAS. Contributor or Owner on the account do not grant data access through Entra ID by themselves.

5. Network rules

The storage firewall decides which networks can reach the account. Set public network access to Enabled from selected virtual networks and IP addresses, then allow:

  • Virtual network rules: subnets with a Microsoft.Storage service endpoint.
  • IP rules: public IP ranges, such as your office.
  • Trusted Microsoft services: such as Azure Backup, Event Grid and Azure Monitor.
  • Private endpoints: a private IP for the account inside your VNet, reachable from on-premises too.

Exam traps to remember

  • AzCopy accepts Entra ID or SAS, not raw account keys.
  • Revoke a SAS by deleting its stored access policy, or by regenerating the signing key.
  • A ReadOnly lock on the account blocks listing keys.
  • Global Administrator alone does not give access to storage data.

Test yourself: 3 check questions and exam-style practice questions on this topic are in the AZ-104 Azure Administrator app.

Practise in the app

Keep going