Share a file safely with a SAS link

Azure Portal, Hands On10 minutesFree tierSteps checked 23 October 2026By Cloud Hands On

In this task you'll create a link that shares one private file for a limited time.

A shared access signature (SAS) is a link that gives limited access to something private: for example, read-only access to one file for the next 24 hours. Whoever has the link can use it, without an Azure account.

A SAS signed with your Entra account (a user delegation SAS) is the safer kind. One signed with the account key works too, but can only be cancelled early by changing the key.

Example. Larkfield Group sends a supplier a link to one invoice blob that works for three days and only allows reading. After that, the link stops working by itself.

Before you start

You need: Storage Blob Data Contributor (for a user delegation SAS) or access to the account keys. Time: 10 minutes.

Where to look

  1. Storage accounts
  2. your account
  3. Containers
  4. docs
  5. your file
  6. Generate SAS

Steps

  1. Open the docs container and select the file you uploaded.
  2. Select Generate SAS.
  3. Set Signing method to User delegation key if it's offered, otherwise Account key.User delegation needs a data role such as Storage Blob Data Contributor on the account.
  4. Set Permissions to Read only, and an expiry time a few hours from now.
  5. Leave Allowed protocols as HTTPS only, then select Generate SAS token and URL.
  6. Copy the Blob SAS URL and open it in a private browser window. The file opens.Try changing a letter in the token: the link stops working, because the signature no longer matches.

Commands

# A read-only link to one blob for 24 hours, signed with your Entra account
az storage blob generate-sas --account-name <account> --container-name docs \
  --name hello.txt --permissions r --https-only \
  --expiry $(date -u -d '+1 day' '+%Y-%m-%dT%H:%MZ') \
  --auth-mode login --as-user --full-uri

Watch out for

Cost
Creating a SAS is free. You pay the normal charges for data read through it.
Security
Anyone who has the link has the access, so keep permissions narrow and the expiry short. A link signed with the account key can't be cancelled without rotating the key, which breaks every other link and app using it.
Common mistakes
Giving write or delete permission when read was enough. Setting an expiry months away. Sharing an account-level SAS when one file was needed.

Clean up

The link stops working on its own at the expiry time. If you used an account key and want to cancel it now, rotate that key under Access keys.

Words to know

SAS token
The part of the link after the question mark that holds the permissions, expiry time and signature.
User delegation SAS
A SAS signed with Entra ID credentials instead of the account key. It lasts at most seven days.
Expiry
The time after which the link stops working.

Tick off each step and track your progress in the guide.

Open this task in Azure Portal, Hands On

Keep going