SAS 网址无效

SAS URLs not working

我正在尝试为 blob 存储容器创建 SAS URL。我尝试了多个存储帐户和多种创建 SAS 的方法,当我在浏览器中测试 SAS URL 时,它们都给出了这个结果:

<Error>
<Code>AuthenticationFailed</Code>
<Message>
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:d95bf34f-0001-0022-4430-b1a25b000000 Time:2016-05-18T18:12:30.5552096Z
</Message>
<AuthenticationErrorDetail>
Signature did not match. String to sign used was rl 2016-05-18T18:10:00Z 2016-05-19T18:10:00Z /blob/cloudappmanager/$root 2015-04-05
</AuthenticationErrorDetail>
</Error>

我试过Storage Explorer(右键单击容器,获取 SAS,使用默认值单击确定):

我尝试了旧的存储资源管理器:

我尝试了 PowerShell:

PS C:\Users\virklba> $context = New-AzureStorageContext -StorageAccountName msuscoreaprod 
cmdlet New-AzureStorageContext at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
StorageAccountKey: xxxxxxxxx

PS C:\Users\virklba> New-AzureStorageContainerSASToken -Name aadlogs -Context $context -FullUri -Permission rl
https://msuscoreaprod.blob.core.windows.net/aadlogs?sv=2015-04-05&sr=c&sig=xxxxxxxx&se=2016-05-18T19%3A47%3A56Z&sp=rl

结果都一样。有其他人看到这种行为,还是只有我看到?

您正在容器上创建 SAS,看起来您正试图在浏览器中读取容器。当我将容器 SAS 粘贴到浏览器中时,出现与您相同的错误。

容器 SAS(具有读取权限)为您提供对容器中 blob 的读取权限。因此,在将 Blob 粘贴到浏览器之前,您需要将 Blob 名称附加到 SAS,以便读取 Blob。

例如,这将不起作用:

https://myaccount.blob.core.windows.net/lotsofblobs?st=2016-05-18T22%3A49%3A00Z&se=2016-05-19T22%3A59%3A00Z&sp=rl&sv=2015-04-05&sr=c&sig=62WHwaZGI60ub1hYcQyKg1%2FE%2F1w9HUrOPGorzoWDLvE%3D

这确实有效,myblob.txt 附加到基础 URL:

https://myaccount.blob.core.windows.net/lotsofblobs/myblob.txt?st=2016-05-18T22%3A49%3A00Z&se=2016-05-19T22%3A59%3A00Z&sp=rl&sv=2015-04-05&sr=c&sig=62WHwaZGI60ub1hYcQyKg1%2FE%2F1w9HUrOPGorzoWDLvE%3D

请在此处查看 Gaurav Mantri 的详细说明:Azure Shared Access Signature - Signature did not match

要解决此问题,请先尝试连接存储帐户,然后再连接 blob。