I know I can use the Azure CLI to accomplish this, but I'd like to use common Linux/Unix commands.
I have an Azure Blob Container, which is private. Let's call it https://my-account.blob.core.windows.net/my-blob-container/my-file.my-extension.
If my container is set to "Public read access for blobs only", everything works great.
$ wget https://my-account.blob.core.windows.net/my-blob-container/my-file.my-extension
--2016-04-28 16:11:15-- https://my-account.blob.core.windows.net/my-blob-container/my-file.my-extension
Resolving my-account.blob.core.windows.net (my-account.blob.core.windows.net)... 4.11.2.14
Connecting to my-account.blob.core.windows.net (my-account.blob.core.windows.net)|4.11.2.14|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21682 (21K) [application/octet-stream]
Saving to: ‘my-file.my-extension’
If my container is set to "No public access", and I create an Access policy called my-policy
, with Read/Write/Delete/List for one year, I get the following direct link: https://my-account.blob.core.windows.net/my-blob-container/my-file.my-extension?sv=2015-02-21&si=my-policy&sr=b&sig=y%2B2pvIuR9rGQdvm%2FQKp0xNCWE%2B1G%2F2IqjHkWMhRcPUA%3D
If I copy the link into a browser, the file downloads automatically. If I use wget
, I get a 404 error:
$ wget https://my-account.blob.core.windows.net/my-blob-container/my-file.my-extension?sv=2015-02-21&si=my-policy&sr=b&sig=y%2B2pvIuR9rGQdvm%2FQKp0xNCWE%2B1G%2F2IqjHkWMhRcPUA%3D
[4] 14106
[5] 14107
[6] 14108
[2] Done si=my-policy
[3] Done sr=b
$ --2016-04-29 01:25:54-- https://my-account.blob.core.windows.net/my-blob-container/my-file.my-extension?sv=2015-02-21
Resolving my-account.blob.core.windows.net (my-account.blob.core.windows.net)... 4.11.2.14
Connecting to my-account.blob.core.windows.net (my-account.blob.core.windows.net)|4.11.2.14|:443... connected.
HTTP request sent, awaiting response... 404 The specified resource does not exist.
2016-04-29 01:25:54 ERROR 404: The specified resource does not exist..
wget
returns Exit Stats 8 ("Server issued an error response").
st
,se
, andsp
as you suggest, but the error message is the same (HTTP/1.1 404 The specified resource does not exist.
). It still puzzles me because a web browser has no difficulty downloading the file with exactly the same URL. - numeratus