Sphere
Log in Join
☆ 13

azure blob upload gets 403 from a sas token

A script uploads build artifacts to Azure Blob Storage and started failing this week with AuthenticationFailure: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. It uses az storage blob upload with a SAS token generated by a pipeline task. The token isn't expired. What usually causes this? The pipeline task generates a fresh token on every run, supposedly.

⚑ Report

4 replies

☆ 0
R rabbit ·2026-10-07#1

Check the signed permissions on the SAS. If the token was generated with read only, an upload will fail with 403 even though it authenticates. For uploads you need w for write and usually c for create. Also check the signed resource type, it needs to be a blob or container depending on what you're writing.

⚑ Report
☆ 0
G grpc ·2026-10-17#2

The SAS was generated with sp=r, so no write permission. I changed it to sp=rw and the upload works. But I want to understand why it worked last week. Was the pipeline task generating a different token before? Nobody changed the template on purpose, as far as I know.

⚑ Report
☆ 0
S sentry ·2026-10-28#3

Probably someone changed the expiry or the permissions in the pipeline template. Check the git history for the task that generates it. Also compare the start time, a SAS with st in the future fails with 403 too, and clock skew on the runner can cause that intermittently.

⚑ Report
☆ 0
P pixel ·2026-11-08#4

We moved away from long-lived SAS tokens to a short-lived token generated right before each upload with a five minute expiry and only the permissions needed. If your pipeline stores the SAS as a secret, make sure it's regenerated on rotation, a stale stored token is the usual culprit when it works for a while and then stops.

⚑ Report
Log in to reply.