0
votes

I am generating SAS token from PowerShell but when I am trying to access that token from Azure Storage explorer, it is giving problem "Authentication Error. Signature fields not well formed."

here is the full Powershell command :-

Parameter required

$StorageAccountName = 'XXXXXX'

$ResourceGroup = 'remoteaccess'

$ContainerName = "vhds"

Powershell Cmd

$AzStrAct = Get-AzureRmStorageAccount -Name $StorageAccountName -ResourceGroupName $ResourceGroup

$AzStrKey = Get-AzureRmStorageAccountKey -Name $StorageAccountName -ResourceGroupName $ResourceGroup

$AzStrCtx = New-AzureStorageContext $StorageAccountName -StorageAccountKey $AzStrKey[0].Value

Get-AzureStorageContainer -Name $ContainerName -Context $AzStrCtx

$ContainerSASTokenURI = New-AzureStorageContainerSASToken -Name $ContainerName -Permission "rwdl" -StartTime "2017-04-12" -ExpiryTime "2017-04-16" -Context $AzStrCtx -FullUri

Write-Host "The SAS Token of container as below:"

$ContainerSASTokenURI

output

https://XXXXXXX.blob.core.windows.net/vhds?sv=2015-04-05&sr=c&sig=XXXXXXXXXXXXXXXXXXXXXXXX&st=2017-04-1 1T18%3A30%3A00Z&se=2017-04-15T18%3A30%3A00Z&sp=rwdl

1
Please try something for me :). Append &restype=container&comp=list to your SAS URL, and then paste that URL in a browser's address bar. Are you seeing the same error there or are you able to see the blobs in that container? - Gaurav Mantri
Okay so when I am appending '&restype=container&comp=list' to my SAS URL, it is displaying the BLOB. So it is working but every time we need to do this manually? - Abhishek kumar
No...I just wanted to make sure that your SAS URL is correct which is indeed the case. I think the issue is with Azure Storage Explorer. - Gaurav Mantri
but I am using latest Azure explorer. So any idea what could be the issue? - Abhishek kumar

1 Answers

0
votes

I test with your script, and it works for me, my Azure storage explorer version is 0.8.12, I suggest you upgrade Azure storage explorer's version to 0.8.12.