Azure Blob Storage (REST API): Cannot download blob in container with curl using SAS token
I have been playing around with using the Azure Blob storage REST API for a few days now.
I can connect to the resource, list containers, generate SAS tokens for any given container and also, just recently, list blobs within a container (See here:Azure Blob Storage (REST API): Cannot list blobs in container with curl using SAS token) with no problems.
However, I am now having problems when trying to download a blob within a container using the SAS token I have generated for the container.
With my generated SAS token I have tried the following curl command to download the blob:
curl -X GET "https://dat3473spa01cfeMtest.blob.core.windows.net/90480397-91234697-218-test-dir01/3c6a1ba9-2168-4171-8311-813e3762108b.txt&sv=2019-02-02&sr=c&sig=QlSozpknsTcR4frUK08%2FrcGaUGY893GzFN1Lyhl74Ao%3D&se=2024-10-24T07%3A50%3A11Z&sp=racwdl"
Where:
blobServiceUri: https://dat3473spa01cfeMtest.blob.core.windows.net
container name: 90480397-91234697-218-test-dir01
blob name: 3c6a1ba9-2168-4171-8311-813e3762108b.txt
SAS token for container: ?sv=2019-02-02&sr=c&sig=QlSozpknsTcR4frUK08%2FrcGaUGY893GzFN1Lyhl74Ao%3D&se=2024-10-24T07%3A50%3A11Z&sp=racwdl
When I run the curl command I get the error:
ResourceNotFound
The specified resource does not exist.
RequestId:8feff5f9-001e-006d-5b18-260db0000000
Time:2024-10-24T13:28:25.9692381Z
Running either of the following curl commands (replacing .txt& in my initial curl command by either .txt&? or .txt?):
curl -X GET "https://dat3473spa01cfeMtest.blob.core.windows.net/90480397-91234697-218-test-dir01/3c6a1ba9-2168-4171-8311-813e3762108b.txt&?sv=2019-02-02&sr=c&sig=QlSozpknsTcR4frUK08%2FrcGaUGY893GzFN1Lyhl74Ao%3D&se=2024-10-24T07%3A50%3A11Z&sp=racwdl"
curl -X GET "https://dat3473spa01cfeMtest.blob.core.windows.net/90480397-91234697-218-test-dir01/3c6a1ba9-2168-4171-8311-813e3762108b.txt?sv=2019-02-02&sr=c&sig=QlSozpknsTcR4frUK08%2FrcGaUGY893GzFN1Lyhl74Ao%3D&se=2024-10-24T07%3A50%3A11Z&sp=racwdl"
gives the error:
BlobNotFound
The specified blob does not exist.
RequestId:4978f267-601e-0043-3419-26bc10000000
Time:2024-10-24T13:32:22.1650304Z
When I list the blobs in the container with the command
curl -X GET "https://dat3473spa01cfeMtest.blob.core.windows.net/90480397-91234697-218-test-dir01?restype=container&comp=list&sv=2019-02-02&sr=c&sig=QlSozpknsTcR4frUK08%2FrcGaUGY893GzFN1Lyhl74Ao%3D&se=2024-10-24T07%3A50%3A11Z&sp=racwdl"
I get:
90480397-91234697-218-test-dir01/3c6a1ba9-2168-4171-8311-813e3762108b.txt
So the blob is listed but I cannot download it!
Read more here: Source link
