Azurite SAS query token access to blob file
See original GitHub issueWhich service(blob, file, queue, table) does this issue concern?
blob
Which version of the Azurite was used?
$ docker run --rm mcr.microsoft.com/azure-storage/azurite:latest azurite --version
3.15.0
Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)
mcr.microsoft.com/azure-storage/azurite:latest
What’s the Node.js version?
/opt/azurite # node --version
v14.17.0
What problem was encountered?
SAS token access does not work when the connect string references service endpoints not running on localhost, as per default.
Steps to reproduce the issue?
I am using two separate containers, one called “azurite” running azurite, and one called “func” that hosts the local Azure Function App development environment. If I run the function app stack on the host directly and use a connection string that references localhost (and export those ports as per documentation on Azurite) it works.
The following code will give me an URL that I can access in Azure, but Azurite will give a 403.
import { BlobClient, BlobSASPermissions } from '@azure/storage-blob'
try {
const blobName = "input.json"
const client = new BlobClient(connectionString, "invoices", blobName)
const options = {
permissions: BlobSASPermissions.from({ read: true }),
expiresOn: new Date(Date.now() + 24 * 3600 * 1000),
// startsOn: new Date(Date.now() - 300 * 1000),
// protocol: SASProtocol.HttpsAndHttp,
}
//const url = (await client.generateSasUrl(options)).replace(/%2F/g,"/")
const url = await client.generateSasUrl(options)
context.log(url)
}
catch (err) {
console.log(err)
}
Have you found a mitigation/solution?
No
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Create SAS tokens for your storage containers - Microsoft Learn
How to create Shared Access Signature tokens (SAS) for containers and blobs with Microsoft Storage Explorer and the Azure portal.
Read more >How to Generate an Azure SAS Token to Access Storage ...
Learn how to create an Azure SAS token both via the Azure portal and via PowerShell to authenticate and authorize Azure storage management....
Read more >Azure Blob Storage SAS Guidelines
Azure Blob Storage provides the concept of “shared access ... Sometimes I see code that passes just the SAS token, and the name...
Read more >Azurite V3 - npm
Blob storage features align with Azure Storage API version 2020-10-02 ... SharedKey/Account SAS/Service SAS/Public Access Authentications ...
Read more >Azure Blob how to properly create and consume a SAS token
After much trial and error my ways to fix it were as follows: Use latest version of azurite from Microsoft, I used the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
try upgrading to azurite 3.17.1 there were several bugs related to SAS validation in azurite versions < 3.17.0
see here for some examples:
I will look into it this weekend hopefully.