Microsoft Docs

Understanding Shared Access Signatures (SAS) for Blob Storage

Shared Access Signatures (SAS) provide a secure way to grant limited access to objects in your Azure Storage accounts, such as blobs, without needing to share your account access keys.

What is a Shared Access Signature?

A SAS is a URI that contains a security token in its query string. This token allows specific access permissions to a resource for a specific period of time. SAS tokens can be used for:

Types of SAS

Azure Storage offers two types of SAS:

  1. Service SAS: Delegates access to blobs, queues, tables, or files, but not to the storage account itself. Service SAS is generated from the account access key.
  2. Account SAS: Delegates access to one or more storage resources. It can grant access to any of the storage resources that a service SAS can access. An account SAS is signed with the storage account's key.

Creating a SAS

You can create a SAS using the following methods:

Example of a SAS URI (Service SAS for a blob)

A typical SAS URI looks like this:

https://myaccount.blob.core.windows.net/mycontainer/myblob.txt?sv=2020-08-04&ss=b&srt=sco&sp=r&se=2023-12-31T12:00:00Z&st=2023-12-31T10:00:00Z&spr=https&sig=aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890abcDEF==

Here's a breakdown of common SAS parameters:

Important: Always use HTTPS for SAS tokens to ensure secure communication.

Permissions

When creating a SAS, you can specify the following permissions:

SAS Security Best Practices

Tip: Consider using Azure Key Vault to securely store and manage your storage account keys, which are used to generate SAS tokens.

Key Differences: SAS vs. Shared Key Authorization

Shared Key authorization uses your storage account access keys to authenticate requests. SAS provides a more granular and time-limited approach to access, reducing the risk associated with sharing full access keys.

Learn More

For in-depth information and advanced scenarios, refer to the official Azure Storage documentation: