A SAS is a bearer token encoded in a URL. It can delegate selected permissions without sharing the storage account key, but anyone who obtains the SAS can use it until it expires or is otherwise invalidated. User delegation SAS, signed with Microsoft Entra credentials, is generally preferred for Blob Storage where supported.
Before You Begin
- An Azure storage account and target container or blob.
- An identity with the required data-plane permissions.
- A defined use case, permission set, and short validity window.
Recommended Approach
1. Select the SAS type
For Blob Storage, evaluate a user delegation SAS signed using Microsoft Entra credentials. Service SAS and account SAS have different scopes and signing requirements; use the narrowest type that satisfies the scenario.
2. Scope the resource
Choose a single blob when possible rather than an entire container or account. Grant only read, write, create, or delete permissions required for the task. Avoid broad list permissions unless the client genuinely needs them.
3. Set validity and network limits
Use a short start and expiry window, account for clock skew, and consider IP or protocol restrictions where practical. Keep the token lifetime aligned with the actual workflow.
4. Generate the SAS on a trusted backend
Create the SAS server-side after authenticating and authorizing the requesting user. Do not put account keys or SAS-generation secrets in browser JavaScript.
5. Deliver and revoke thoughtfully
Send the URL over HTTPS, avoid logging it, and do not expose it through referrer headers. If a SAS is compromised, revoke or rotate the signing material as supported by its SAS type and design.
Operational Considerations
Cloud storage and compute designs should account for security, availability, lifecycle, and cost together. Decide where data resides, how long it is retained, which identities can reach it, and how the service behaves during a regional or credential failure. Separate production and test resources when their access needs differ. Review data-transfer charges, request volume, version retention, and abandoned multipart uploads as part of routine operations.
How to Verify the Result
Test the workflow using the same role and network path that the deployed application will use. Verify successful access to the intended object or service, denial for an unrelated object, and behavior after a temporary credential expires. Check logs for the principal and operation, and confirm that lifecycle, versioning, and backup settings match the data-retention policy.
Example Configuration
Illustrative example — adapt values to your environment
# Example URL shape only — do not use placeholder values as a live token
https://ACCOUNT.blob.core.windows.net/CONTAINER/FILE?sv=...&se=...&sp=r&sig=...
Common Mistakes to Avoid
- A SAS URL is a credential; never publish it in public HTML or analytics events.
- A SAS is not necessarily one-time-use. Enforce one-time workflows with server-side state if required.
- Stored access policies and revocation options differ by SAS type; plan revocation before choosing the design.
Make one change at a time, test it from the perspective of the actual user or application, and record the reason for the change. Keep a rollback path for network, identity, and production configuration changes.
Final Checklist
- The configuration matches the intended environment and service version.
- Access is limited to the required identities, resources, ports, and operations.
- The expected workflow has been tested, including a negative test for unauthorized access.
- Secrets and temporary credentials are protected and excluded from logs and source control.
- The configuration owner, purpose, and review or expiration date are documented.