简体   繁体   中英

Azure CLI and SAS Token issue in PowerShell

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?

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:

az storage blob upload-batch --account-name <strgAccountName> -s <sourcefilepath> -d 'https://xxxxxx.blob.core.windows.net/cont1' --sas-token '<generatedSAStoken from portal>'

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.

I don't know what was wrong, but suddenly it started to work with '"sastoken"' format. Thanks for your responses.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM