PowerShell 中的 Azure CLI 和 SAS 令牌问题
我在 Azure 门户中生成了 SAS 令牌,并尝试使用它将文件上传到 blob 存储:
az 存储 blob upload-batch --source ./test --destination '$web' --account-name 'myaccountname' --sas-token '"sp=racwl&st=2022-02-22T17:04:19Z&se=2022-12-23T01:04:19Z&spr=https&sv=2020-08-04&sr=c&sig=mXXXXXXXXXXXXXXXXXXXXXXXXXXXONfAA% 3D”'
但上面的命令给了我以下错误在 PowerShell 中:
<AuthenticationErrorDetail>Signature fields not well formed.</AuthenticationErrorDetail>
我实际上是从 Azure 门户复制 SAS 令牌,那么它到底怎么会出现格式错误呢?
I generated SAS token in Azure Portal and trying to use it to upload files to blob storage:
az storage blob upload-batch --source ./test --destination '$web' --account-name 'myaccountname' --sas-token '"sp=racwl&st=2022-02-22T17:04:19Z&se=2022-12-23T01:04:19Z&spr=https&sv=2020-08-04&sr=c&sig=mXXXXXXXXXXXXXXXXXXXXXXXXXXONfAA%3D"'
But above command gives me following error in PowerShell:
<AuthenticationErrorDetail>Signature fields not well formed.</AuthenticationErrorDetail>
I am literally copying the SAS Token from Azure Portal so how on earth can it be malformed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们在本地环境(使用 powershell v5.1 运行)中运行了相同的
az storage blob upload-batch
cmdlet我们可以将文件从本地计算机上传到存储帐户,如下所示。这是我们使用的 cmdlet:
这是供参考的示例输出:
注意:
cmdlet,我们已经尝试过传递 SAS 令牌并附加(单引号+问号)“?” &在这两种情况下,无需将单引号传递给
--sas-token
标志,我们就可以将文件从本地计算机上传到 Azure 存储容器。We have ran the same
az storage blob upload-batch
cmdlet in our local environment( which is running with powershell v5.1) & we are able to upload the files from local machine to the storage account as shown in below.Here is the cmdlet we have used :
Here is the sample Output for reference:
Note:
To the above cmdlet, We have tried passing the SAS token with appending(single quote+ question mark) '?' & without passing in single quote's to the
--sas-token
flag in both the cases we are able to upload the files from local machine to Azure storage container.我不知道出了什么问题,但突然它开始以
'"sastoken"'
格式工作。感谢您的回复。I don't know what was wrong, but suddenly it started to work with
'"sastoken"'
format. Thanks for your responses.