☁️

Upload file to Azure Blob Storage using SAS URL

Learn how to securely upload files using a SAS token

🧭 Step 1: Generate SAS URL

  • Login to https://portal.azure.com
  • Click on Storage accounts
  • Select your storage account (e.g., logstorage)
  • Click on Storage browser
  • Click on Blob containers and choose your container (e.g., abcd-logs)
  • Click the 3-dot menu on right end of this selected container's row and select Generate SAS
  • Set permissions: ✅ Read, Create, Write
  • Set a future expiry date and click Generate SAS token and URL

🔗 Step 2: Construct Upload URL

Copy the generated URL from bottom of screen and modify it to include your JSON file name after the container name and before the ? part.

Structure Example:

https://<storage_account>.blob.core.windows.net/<container>/myfile.json?sv=...&sig=...

Final URL Example :

"https://logstorage.blob.core.windows.net/abcd-logs/myfile.json?sv=2025-01-01&ss=b&srt=o&sp=rcw&se=2025-12-31T23:59:59Z&st=2025-08-04T00:00:00Z&spr=https&sig=aaaaaaaa"


📤 Step 3: Upload JSON File

  • Use PUT as the request method.
  • Set request body to the raw JSON content. (File that is getting uploaded)
  • Headers required :
    Content-Type: application/json
    x-ms-blob-type: BlockBlob
  • You can use Postman, Power Automate, or any tool that supports PUT requests.

Success: Empty response indicates success ✅

❗ Sample Error (If Something Fails)

<?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.RequestId:9e3c77a1-a01e-003f-3f2e-056c07000000Time:2025-08-04T10:57:16.8054672Z</Message><AuthenticationErrorDetail>Signature did not match. String to sign used was rw2025-08-04T10:35:42Z2025-11-30T18:50:42Z/blob/optimuslogstorage/$roothttps2024-11-04c</AuthenticationErrorDetail></Error>

📝 Tip: Always double-check expiry time and permissions when generating SAS tokens.

Give Feedback