Securing access to storage
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
- Access keys and why they are risky
- The three SAS types, and stored access policies for revocation
- Entra ID data roles and managed identities
- Storage firewall, trusted services and private endpoints
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.
2. Access keys
Every account has two access keys, so you can rotate one while apps use the other.
- Switch apps to key2.
- Regenerate key1.
- Switch apps back to key1.
- 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 type | Signed with | Covers |
|---|---|---|
| User delegation SAS | Entra ID credentials | Blob storage only. The most secure type. |
| Service SAS | Account key | One service (blob, file, queue or table) |
| Account SAS | Account key | One or more services, including service-level operations |
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.
| Need | Role |
|---|---|
| Read blobs | Storage Blob Data Reader |
| Read, write and delete blobs | Storage Blob Data Contributor |
| Full blob control including ACLs | Storage Blob Data Owner |
| Process queue messages | Storage 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