Shared Access Signatures (SAS)

Securely delegate access to Azure Storage resources.

Shared Access Signatures (SAS) provide a secure way to grant limited access to objects in your Azure Storage account without exposing your account access keys. A SAS token is a URI that contains a security token in its query parameters. This token allows a client to access storage resources for a specified period of time, with specific permissions.

Understanding SAS

There are two types of SAS:

When to Use SAS

SAS Token Components

A SAS token is appended to the URI of a storage resource. The key components include:

Generating a SAS Token

You can generate SAS tokens using:

Example using Azure Portal

  1. Navigate to your storage account in the Azure portal.
  2. Select the container or blob you want to grant access to.
  3. Click on "Generate SAS".
  4. Configure the desired permissions, start and expiry times, and resource types.
  5. Click "Generate SAS token and URL".

Service SAS Example (Blob)

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&sig=aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890abcd

Account SAS Example

https://myaccount.blob.core.windows.net/?sv=2020-08-04&ss=bfqt&srt=sco&sp=rwdlacup&se=2023-12-31T12:00:00Z&sig=aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890abcd

Security Considerations

Important:
  • Never expose your account access keys directly.
  • Generate SAS tokens with the minimum necessary permissions and for the shortest possible duration.
  • Be aware of clock skew between the client and server when setting start and expiry times.
  • Store SAS tokens securely, as they grant access to your data.
  • Use an account SAS only when necessary, as it grants broad permissions.

Permissions

Permission Abbreviation Description
Read r Allows reading data and properties of a resource.
Write w Allows writing data and properties to a resource.
Delete d Allows deleting a resource.
List l Allows listing blobs or table entities.
Add a Allows adding new entities to a table.
Create c Allows creating blobs or table entities.
Process p Allows retrieving and deleting messages from a queue.
All * Grants all possible permissions. (Use with extreme caution)

Resource Types

Resource Type Abbreviation Description
Service s Grants access to the service-level resources (e.g., listing all containers).
Container c Grants access to container-level resources (e.g., listing blobs within a container).
Object o Grants access to object-level resources (e.g., a specific blob).

Next Steps