Azure Storage SAS: Delegation, Expiration, and Revocation

Shared access signatures (SAS) can delegate time-limited, resource-specific access to Azure Storage, but their security depends on which signature type is used, how it is issued and how a leaked bearer URL can be revoked. At their core, they function as cryptographically signed URIs that grant precisely scoped permissions to Azure Storage resources for a defined period without requiring the sharing of account keys or the creation of permanent access credentials. That flexibility is useful for bounded sharing with applications and external clients that cannot authenticate directly with Microsoft Entra ID, but it increases the importance of short lifetimes and careful token distribution.

Azure Storage user-delegation SAS is signed using a user-delegation key authorized through Microsoft Entra ID. Changing an identity’s role assignment is not a guaranteed way to immediately revoke already issued SAS tokens. For urgent account-wide revocation, revoke the storage account’s user-delegation keys and allow for cache propagation. Directory-scoped SAS has version and hierarchical-namespace requirements; a virtual folder name alone does not enforce tenant isolation.

Shared access signatures fill a practical gap between long-lived account keys and identity-based access from applications that can authenticate directly with Microsoft Entra ID. An issuer authenticates the requesting client, chooses the specific resource and required operations, then generates a signed token that the consumer presents to Azure Storage. That consumer holds a bearer credential for the token’s lifetime. Revocation mechanisms vary sharply by SAS type, so an issuer must understand exposure and recovery before distributing URLs.

The Three Distinct Types and When to Deploy Each

Azure Storage implements three distinct types of shared access signatures, each designed for different trust relationships and architectural scenarios, and selecting the wrong type for a given situation creates either unnecessary security risk or unnecessary operational complexity. The account shared access signature operates at the highest level of the resource hierarchy, granting access across multiple services within a storage account simultaneously and supporting operations not available through the more restrictive service-level variant. This type suits scenarios where a trusted internal service or administrative tool needs broad but still time-limited access to multiple storage services within the same account.

A user-delegation SAS is signed with a delegation key obtained under Microsoft Entra identity authorization. The key remains valid until its defined expiry unless user-delegation keys are explicitly revoked at the storage-account level; changes to an identity’s access policy are not guaranteed to invalidate previously issued SAS immediately. Azure Storage caching can delay enforcement. Design short token lifetimes and documented emergency key revocation procedures rather than treating disabling an identity as an instantaneous kill switch.

Anatomy of a Shared Access Signature Token Examined in Detail

Dissecting the components of an actual shared access signature token reveals the precise control surface available to architects and helps explain both the power and the responsibility that comes with generating these credentials. Every shared access signature contains a set of query parameters appended to a storage resource URI, and each parameter controls a specific dimension of the access being granted. The signed permissions parameter encodes exactly which operations the bearer can perform, using single character codes where r represents read, w represents write, d represents delete, l represents list, a represents add, c represents create, u represents update, and p represents process for queue messages.

The signed start and signed expiry parameters define the temporal window during which the signature remains valid, and the interaction between these two parameters deserves careful attention because a signature with no start time becomes valid immediately upon generation, while one with a future start time provides a grace period before activation that suits pre-provisioned access scenarios. The signed IP parameter optionally restricts usage to requests originating from specific IP addresses or ranges, adding a network-layer constraint on top of the cryptographic one. The signed protocol parameter limits acceptance to HTTPS-only requests, preventing accidental transmission of tokens over unencrypted connections. Together these parameters compose a precise access specification that the Azure Storage service evaluates on every incoming request bearing the signature.

Stored Access Policies as the Foundation of Revocable Delegation

An ad hoc SAS signed with the account key generally cannot be selectively revoked while keeping all other tokens signed with the same key valid. If a signature with a seventy-two hour validity window is compromised after thirty minutes, the only recourse without stored access policies is rotating the entire storage account key, which invalidates signatures and connection strings signed with that key once the service observes the change, with possible availability impact and propagation considerations. This cascading impact makes key rotation a high-risk operation that organizations often delay far longer than security best practices recommend.

For service SAS tokens where stored access policies are supported, those policies provide an intermediary layer between the signature and its authorization parameters. Account SAS and user-delegation SAS do not use stored access policies in the same way. When a shared access signature references a stored access policy by name rather than embedding all its constraints directly in the token, the actual permissions, start time, and expiry time are stored server-side in the policy definition. Revoking access then requires only deleting or modifying the stored access policy, which revokes signatures that reference it after Azure Storage has applied the policy change; plan for policy propagation delays rather than assuming instantaneous revocation. This separation of the cryptographic token from the authorization parameters is not merely a convenience feature but a fundamental architectural capability that makes shared access signatures viable for security-sensitive production environments where the ability to respond quickly to credential compromise is non-negotiable.

Designing Secure Blob Storage Access Patterns for External Consumers

Blob storage represents the most common context in which shared access signatures appear in real-world Azure architectures, and the design of blob access patterns using these tokens reveals the practical application of theoretical concepts in ways that generic documentation rarely communicates. Consider a content delivery scenario where a media company stores video files in Azure Blob Storage and needs to provide paying subscribers with time-limited download access without exposing the files to the general public or maintaining complex authentication infrastructure within their storage layer.

A subscription application can issue a short-lived read-only SAS when a subscriber is authorized to download a private blob, allowing the client to fetch the object directly from Azure Storage. The service still needs to verify the subscriber’s entitlement before creating the SAS, restrict the token to that object, use HTTPS and avoid leaking the signed URL through analytics, referer headers or logs. A SAS can be copied and reused while valid; a short expiry reduces that exposure window but does not make access single-use or bind the bearer to one subscriber.

Implementing Secure File Upload Workflows Using Write-Only Signatures

The ability to craft write-only shared access signatures that permit uploads without allowing any read, list, or delete operations opens architectural possibilities that many developers overlook when first encountering the technology. A write-only signature for a specific blob path or container allows an external party to deposit files into Azure Storage without ever being able to enumerate what else exists in that container, read files they did not upload themselves, or delete content they previously submitted. This asymmetric capability is enormously valuable in data ingestion scenarios where untrusted or semi-trusted sources provide data that an organization processes internally.

For multi-party blob ingestion, use a separate container or an appropriately supported directory-scoped SAS when the storage account and API version support that resource type. A conventional blob name prefix is not itself a security boundary. Every generated SAS must be restricted to the exact resource and required permissions; the application must separately authorize the requesting tenant before issuing it.

Temporal Scoping Strategies for Different Security Requirements

The relationship between signature validity duration and security risk is not linear, and developing nuanced judgment about appropriate expiry windows for different use cases requires understanding how attackers actually exploit compromised tokens. A signature with a one-year validity window has the same instantaneous access capability as one with a one-hour window, but the exposure duration after compromise is dramatically different. For attackers who obtain tokens through passive means such as log analysis, traffic interception, or browsing repository history, the validity window is the primary factor determining how long the compromised credential remains exploitable.

Choose the shortest SAS validity window that supports the intended task and retry behavior. Interactive downloads may need minutes; longer-running transfers may need a wider window, but every additional hour prolongs the usefulness of a leaked token. Prefer a user-delegation SAS when supported and plan revocation of its delegation keys. For a service SAS with a stored access policy, test policy-revocation propagation. Long-lived, unrevocable ad hoc SAS tokens should not become a convenience default.

Signature Generation Security and the Protection of Signing Keys

The security of service and account SAS tokens signed with Shared Key depends on protecting the storage account key; a user-delegation SAS instead depends on the authorization and user-delegation key obtained through Microsoft Entra ID, creating a critical dependency that must be addressed at the infrastructure design level rather than treated as an operational afterthought. If the account key is compromised, an attacker can generate unlimited valid signatures for any resource in the storage account with any permissions and any validity window, completely bypassing all the carefully designed scoping that individual signatures implement. Protecting signing keys therefore becomes as important as designing the signatures themselves.

For workloads that must use an account key, protect it in a managed secret store, restrict access to the components that genuinely need it, and avoid logging SAS URLs. Prefer user delegation where supported. Managed identities reduce direct credential distribution but do not make compromise or key exfiltration impossible; audit access and test rotation behavior.

Integrating SAS with Microsoft Entra ID

A user-delegation SAS is signed with a user delegation key obtained using Microsoft Entra ID authorization rather than an account access key. To request the delegation key, the principal needs an Azure role assignment that includes the Microsoft.Storage/storageAccounts/blobServices/generateUserDelegationKey action at the appropriate scope; assigning an unrelated blob-data role at the wrong scope is not sufficient. The user delegation key has its own start and expiry times, and a SAS cannot remain valid beyond the key’s expiry. Revoking user delegation keys at the storage-account level invalidates the existing delegation keys subject to service propagation; removing an identity role assignment alone is not a dependable instantaneous revocation method for already issued SAS. Choose a short token lifetime and rehearse emergency revocation.

Cross-Origin Resource Sharing Configuration for Browser-Based Applications

Browser-based applications that use shared access signatures to interact directly with Azure Storage encounter an additional technical constraint in the form of cross-origin resource sharing policies, which browsers enforce to prevent scripts loaded from one origin from making requests to a different origin without explicit permission. Azure Storage supports cross-origin resource sharing configuration at the service level, allowing storage account owners to specify which request origins are permitted, which HTTP methods are allowed, and which headers can be included in cross-origin requests. Without proper cross-origin resource sharing configuration, browser applications that attempt direct storage access using shared access signatures will encounter blocked requests despite possessing valid tokens.

Cross-Origin Resource Sharing (CORS) is a browser access policy, not authorization for Azure Storage. A restrictive allowed-origin list can stop a web page from reading a cross-origin response through ordinary browser APIs, but it cannot revoke a stolen SAS or prevent a non-browser HTTP client from using a valid signature. Microsoft states that an authorized request is still required regardless of CORS configuration. Configure origin, method and header rules narrowly for legitimate client application behavior, then enforce actual resource access through short SAS expiry, scoped permissions, HTTPS, storage network controls, issuer-side tenant authorization and an explicit revocation plan. Treat a leaked bearer SAS as compromised even if its intended website has restrictive CORS; investigate and revoke or expire the underlying delegation where supported.

Audit Logging and Monitoring for Signature-Based Access Events

Enable Azure Storage diagnostic logs before treating SAS access as auditable. Supported storage request logs and metrics can show operations, request outcomes and authorization-related details, but Azure Storage does not maintain a server-side inventory of the SAS tokens that applications generate. A log entry is not a guarantee that a specific issued token or human recipient can be uniquely reconstructed. To close that gap, maintain an issuer-side record of each authorization decision and token-issuance event, including application or tenant identity, intended resource, permissions, generation time and expiry. Never record the complete bearer SAS URL in ordinary logs. Reconcile issuance records with storage-request telemetry during an incident, and preserve logs according to the organization’s retention and privacy requirements.

Send Azure Storage resource logs to a Log Analytics workspace and query them with Kusto Query Language for denied operations, unusual request rates, unexpected source addresses and repeated access to sensitive resources. When Microsoft Sentinel is deployed, relevant analytics rules can join storage telemetry with identity, workload and application signals. Because SAS issuance itself is not tracked by Azure Storage, pair these service logs with application-issued token records; do not claim that the logs necessarily identify a unique signature or reliably determine a user’s geography. Alert thresholds and investigation queries need testing against actual log schemas and authorized operational patterns.

Handling Token Expiration Gracefully in Production Applications

An application must know when a SAS expires and how to request a replacement before a client retries a long-running operation. Failures can come from clock skew, lost network connectivity, revoked signing material, a changed stored access policy or a token whose permissions never allowed the operation. Log the error code and correlation metadata, not the signed URL itself. Clients should obtain a fresh token from an authenticated issuer rather than repeatedly retry a compromised or expired credential.

Set token refresh based on operation length, network behavior and issuer capacity. For a one-hour SAS, requesting a replacement before the last fifteen minutes may be reasonable, but it is an application policy rather than an Azure requirement. If renewal fails, surface a recoverable error and confirm the user is still authorized before issuing another bearer credential. A stored access policy cannot be used as a universal renewal or revocation mechanism because user-delegation and account SAS do not support it.

Multi-Tenant Architecture Patterns Using Scoped Signatures

More sophisticated implementations combine signature-based access delegation with server-side application logic that validates tenant context before generating signatures, ensuring that a tenant can only receive signatures for their own designated storage paths regardless of what path they request. This defense-in-depth approach means that application-layer access controls and storage-layer cryptographic controls reinforce each other, with neither layer being solely responsible for maintaining isolation. Logging all signature generation events with tenant identifiers creates an audit trail that helps investigate cross-tenant access anomalies and demonstrates compliance with data isolation requirements to enterprise customers and regulatory auditors.

Disaster Recovery Considerations for Signature-Dependent Architectures

Applications that rely heavily on shared access signatures for their storage access model must include signature regeneration and distribution in their disaster recovery planning, because a recovery scenario that restores data to a new storage account but fails to update signatures across all consuming applications and services results in a recovery that succeeds at the data layer but fails at the access layer. This type of partial recovery failure is particularly insidious because it may not be detected until the first application component attempts storage access following failover, potentially hours into an incident when operational teams are already under maximum stress.

Disaster recovery runbooks for signature-dependent architectures should explicitly document every application component that holds shared access signature tokens, the process for regenerating signatures against the recovery storage account, the distribution mechanism for delivering updated tokens to each component, and the verification steps confirming that each component has successfully resumed storage access using the new signatures. Automating as much of this process as possible through infrastructure as code templates that generate and distribute new signatures as part of the failover workflow reduces both recovery time and the risk of human error during high-pressure incident response situations.

Compliance and Regulatory Alignment Through Signature-Based Controls

HIPAA, PCI DSS, GDPR and assurance programs such as SOC 2 establish control and evidence obligations; none grants automatic compliance merely because an application uses SAS. The authorization decision, permission scope, token lifetime, isolation design, audit logging and incident-response process must be tested against the specific environment and legal requirements. Document how the issuer prevents unintended token generation and how a compromised SAS is made unusable.

For auditors and incident responders, capture the authorization rules controlling token issuance, the approved resource and permissions, signing-key protection, expiry policy and response plan for a leaked URL. Azure Storage does not keep an inventory of each SAS issued, so application-side issuance records and service request logs play complementary roles. They do not inherently establish the identity of every human who used a token. Verify actual log schema fields and retention before claiming traceability or compliance.

Conclusion

SAS is useful when a client needs narrowly scoped access without receiving a storage account key, but its convenience can conceal a large bearer-token exposure. Choose the signature type by resource, issuer identity, required permission and revocation model. If the client can authenticate to Azure Storage through Microsoft Entra ID directly, that may remove the need to distribute SAS URLs.

A production design must account for token leakage, expiration, emergency invalidation, network restrictions and tenant isolation—not just syntactically valid signed parameters. Test denied requests and the emergency response path before depending on SAS as a security boundary.

A sound SAS design begins with the identity making the authorization decision, the resource and exact permissions being delegated, a short expiry and an explicit compromise response. Prefer Microsoft Entra authentication directly when the client can use it, or a user-delegation SAS when delegation is needed and supported. Use stored access policies for supported service SAS cases—not as a universal revocation control for user-delegation or account SAS. Document how the application isolates tenants, prevents bearer-token logging, rotates or revokes signing material, and recovers from expired or compromised credentials. Review these boundaries against real incidents and configuration tests rather than relying on token syntax alone.

The operating test is concrete: a permitted client can complete only the intended storage operation, an unrelated client or object is denied, an expired token fails, the application does not leak signed URLs in logs, and the team can explain which incident-response action invalidates an exposed signature.

Leave a Reply

How It Works

img
Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
img
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
img
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!