Skip to content

Azure: authenticate with a SAS token - #76

Open
ludovngh wants to merge 1 commit into
livekit:mainfrom
ludovngh:azure-sas-token
Open

ludovngh wants to merge 1 commit into
livekit:mainfrom
ludovngh:azure-sas-token

Conversation

@ludovngh

@ludovngh ludovngh commented Dec 1, 2026 •

Copy link
Copy Markdown

Azure Blob can be reached only with the storage account key or a token credential. The account key grants full access to every container in the account, so many teams cannot hand it out. A shared access signature (SAS) can be scoped to one container or prefix, to write and create only, with a short expiry.

What changed:

  • AzureConfig.SASToken (yaml sas_token). When AccountKey is empty and no TokenCredential is set, NewAzure builds the client with azblob.NewClientWithNoCredential on the service URL with the token as its query (a leading ? is stripped). The SDK copies that query onto every request.
  • Returned locations are still built from the service URL alone, so the token never appears in one.
  • PresignedURL with only a SAS token returns an error. A SAS cannot sign another SAS, and returning a URL with the configured token would hand out its write access for its whole lifetime. Callers that need presigned URLs keep using the account key or a token credential.
  • The precedence is unchanged for existing configs: account key, then token credential, then SAS.

How tested: new TestAzureSASToken in contract_test.go uploads to an httptest server and checks the SAS query parameters arrive on the request with no Authorization header, that the location has no token, and that PresignedURL fails. go test ./... in the root module passes. I did not run the e2e module (needs Docker).

Related PRs:

🤖 Generated with Claude Code

AzureConfig.SASToken (yaml sas_token) is used when no account key or
token credential is set: the client sends it as the query of every
request. PresignedURL fails with only a SAS, which cannot sign another.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Dec 1, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants