I guess the SAS token you got is wrong. You could try to generate the SAS token in Azure Portal(navigate to your blob -> Generate SAS), and get blob with GET https://<storage-name>.blob.core.windows.net/<container-name>/myblob.txt?<sas-token>
.
The sample code using generateBlobSASQueryParameters
to generate the container SAS token. If you want the blob SAS, add blobName to parameters.
var storage = require("@azure/storage-blob")
// Use StorageSharedKeyCredential with storage account and account key
const sharedKeyCredential = new storage.StorageSharedKeyCredential(account, accountKey);
var expiryDate = new Date();
startDate.setTime(startDate.getTime() - 5*60*1000);
expiryDate.setTime(expiryDate.getTime() + 24*60*60*1000);
const containerSAS = storage.generateBlobSASQueryParameters({
expiresOn : expiryDate,
permissions: storage.ContainerSASPermissions.parse("rwl"),
protocol: storage.SASProtocol.Https,
containerName: containerName,
startsOn: startDate,
version:"2018-03-28"
}, sharedKeyCredential).toString();
You could test your SAS token with AnonymousCredential
in typescipt sample.
But appending the SAS token to the blob URL is not working.
- What do you mean by this? What is not working? Please edit your question and include these details. Also share the SAS token (you can obfuscate things like account name andsig
portion of the SAS token) in the question. – Gaurav Mantri