Skip to main content

Shared Access Signature

A Shared Access Signature (SAS) is a signed URI token that grants limited, time-bound access to Azure Storage resources without sharing the account key. It encodes the permissions, expiry time, and optional IP restrictions in the token itself.

Shared Access Signature

A SAS lets you hand a client narrow access to one blob, container, queue, table, or file share. There are three types: a user delegation SAS signed with Entra ID credentials, a service SAS signed with the account key for one service, and an account SAS signed with the key across services. A user delegation SAS is the most secure and is Microsoft's recommendation for Blob Storage.

How Do You Generate a Short-Lived SAS?

Bash
az storage blob generate-sas --account-name mumbaiprodstorage \
--container-name settlements --name report-aug-2026.csv \
--permissions r --expiry 2026-08-20T18:00:00Z \
--https-only --as-user --auth-mode login --full-uri

How Do You Revoke a SAS?

A SAS signed with the account key cannot be revoked individually except by tying it to a stored access policy that you then delete, or by rotating the key, which breaks every SAS signed with it. A user delegation SAS can be revoked by revoking the user delegation key.

flowchart LR C(["Client"]):::person -->|asks| API["Your backend"]:::tool API -->|issues 15 min SAS| C C -->|SAS URL, read only| B["Blob Storage"]:::cloud classDef person fill:#EDE9FE,color:#1E293B classDef tool fill:#326CE5,color:#FFFFFF classDef cloud fill:#D1FAE5,color:#1E293B

Why It Matters in Production

A payments company like Razorpay can issue a 15-minute read-only SAS when a merchant downloads a settlement report, so the account key never reaches the browser.

Security

A leaked account key grants full control until rotated. A leaked SAS grants only its permissions until it expires, so keep expiries short and permissions minimal.

Common Mistake

Embedding a long-lived SAS in client-side JavaScript or a public repository. It becomes a permanent credential nobody can easily revoke.

Frequently Asked Questions

How is a SAS different from a storage account key?

The account key gives unrestricted access to everything in the account until rotated. A SAS is scoped to specific resources and permissions, and it expires.

Why is a user delegation SAS preferred?

It is signed with Entra ID credentials instead of the account key, so it follows your identity controls and can be revoked without rotating the key.

Does a SAS work with Private Endpoints?

Yes, but the client still needs network access to the endpoint. A SAS controls authorisation and does not bypass network rules.

Found a mistake, an outdated step or a broken link?