我有一个Azure Blob容器,它是私有的.我们称之为https://my-account.blob.core.windows.net/my-blob-container/my-file.my-extension.
如果我的容器设置为“仅对blob进行公共读取访问”,那么一切都很有效.
$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-extensionResolving my-account.blob.core.windows.net (my-account.blob.core.windows.net)... 4.11.2.14Connecting 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 OKLength: 21682 (21K) [application/octet-stream]Saving to: ‘my-file.my-extension’
如果我的容器设置为“无公共访问”,并且我创建了一个名为my-policy的访问策略,其中包含一年的读/写/删除/列表,我将获得以下直接链接:https:// my-account. blob.core.windows.net/my-blob-container/my-file.my-extension?sv=2015-02-21\u0026amp;si=my-policy\u0026amp;sr=b\u0026amp;sig=y+2pvIuR9rGQdvm/QKp0xNCWE+1G/ 2IqjHkWMhRcpuA =
如果我将链接复制到浏览器中,文件会自动下载.如果我使用wget,我会收到404错误:
$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-21Resolving my-account.blob.core.windows.net (my-account.blob.core.windows.net)... 4.11.2.14Connecting 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返回Exit Stats 8(“服务器发出错误响应”).
解决方法 没有具体细节,查询很难调试,但……我可以在容器级别创建一个SAS,允许我读取存储中的文件
wget“https://azurerpkg.blob.core.windows.net/azurer/doggIEs.jpg?st=2016-06-06T07:56:00Z\u0026amp;se=2018-06-07T07:56:00Z\u0026amp;sp=rl\u0026amp; sv = 2015-04-05& sr = c& sig = nKQz5BcWoUaASBzSW7Hv0TzfMbTFcf0f + 5mMtmTwQ2A =“ – k -O”doggIEs.jpg“
如果我在blob级别创建一个特定的SAS,我的wget也可以
wget“https://azurerpkg.blob.core.windows.net/azurer/doggIEs.jpg?st=2016-06-06T07:56:00Z\u0026amp;se=2018-06-07T07:56:00Z\u0026amp;sp=rl\u0026amp; sv = 2015-04-05& sr = b& sig = ntNFXS6fulHVkiqoqj2rHg1Pw6gSNosnYqj3CQ6GIrg =“ – k -O doggIEs.jpg
> st
> se
> sp
> sr
> sig
您的似乎缺少se组件,即失效日期.
由于某些URL编码的性质,您在进行wget调用时必须确保URL包含在语音标记中
总结以上是内存溢出为你收集整理的使用wget或curl下载具有共享访问签名的Azure Blob全部内容,希望文章能够帮你解决使用wget或curl下载具有共享访问签名的Azure Blob所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)