Azure Function to return a SAS token for a file within a given Storage Account
- A Storage account
- Create a container named
images
in the storage account
Add the connection string for the storage account in the local.settings.json
file for saabhiimages
& AzureWebJobsStorage
. Run the function app from VS code.
Test it by running a curl request & replace the blobname
with the file stored in images
container
http://localhost:7071/api/{blobname}
# request
curl http://localhost:7071/api/betta-fish.png
# response
sv=2021-10-04&spr=https&st=2023-01-09T19%3A42%3A32Z&se=2023-01-09T19%3A52%3A32Z&sr=b&sp=r&sig=xil%2BD6aQzPl0Wx5SnvMPvzVKzlJgh9X3KM5jWCN4GaU%3D
Add the application setting AzureWebJobssaabhiimages
in function configuration.
# run the curl request
curl https://fn-valet-key.azurewebsites.net/api/betta-fish.png?code=xxxxxxxxxxxxx