【发布时间】:2021-11-05 16:17:45
【问题描述】:
我刚开始使用 Azure 存储帐户(请耐心等待)。
我有一个要求,我必须上传文档(特别是 .docx、.txt 和 .csv。
为此,我创建了 Azure 存储帐户并添加了文件共享。随后,我生成了 SAS 令牌。
我的存储帐户是公开可用的,并且网络选项卡已选择所有网络。
现在,我尝试使用 REST API 上传我的文档,这是我的邮递员代码 sn-p
PUT /sharedname/subdir/BlobTesting.txt HTTP/1.1
Host: mystorageaccount.file.core.windows.net
x-ms-type: file
x-ms-file-permission: inherit
x-ms-file-attributes: ReadOnly
x-ms-file-creation-time: now
x-ms-file-last-write-time: now
x-ms-content-length: 102
Date: Wed, 08 Sep 2021 23:23:20 GMT
Authorization: SharedKey mystorageaccount: xxxxxxxx
x-ms-version: 2020-04-08
我收到以下错误消息
<?xml version="1.0" encoding="utf-8"?>
<Error>
<Code>InvalidAuthenticationInfo</Code>
<Message>Authentication information is not given in the correct format. Check the value of Authorization header.
RequestId:155df990-401a-007e-4d09-a5aba4000000
Time:2021-09-08T23:31:50.5455929Z</Message>
</Error>
另外,我想知道如何上传文件的内容以及我没有找到任何具体方法的文档。
请有人帮忙。
谢谢
【问题讨论】:
-
如果您使用共享访问签名,则不需要
Authorization和Date标头。您的请求 URL 应类似于https://account.file.core.windows.net/sharedname/subdir/BlobTesting.txt?sastoken。您可以通过删除这两个标头来重试吗?
标签: azure azure-storage azure-blob-storage