Azcopy and bLob share command correct syntax

I need the correct syntax in order to upload a file to Azure Blob share

$sastoken = “sv= Secret Token held”

File-
$sastoken = “sv=Secret Token held”

./azcopy cp \company\share\completed.txt “https://Somewhere?$sasToken” --recursive=true

Blob-
PS C:\azcopy_windows_amd64_10.28.0> ./azcopy cp \Company\share\completed.txt “https://Somewhere.blob.core.windows.net/dxt-out/?$sasToken” --recursive=true

Hello and welcome to the Powershell forum. azcopy is a cmdline utility, not a Powershell cmdlet/function. Any syntax questions you have can typically be answered by the documentation: azcopy Documentation
reading it myself (not having used it) your syntax looks right to me, but you haven’t provided any information about what issue you’re having or errors you’re encountering.

Also, on any forum, when sharing code it’s necessary/helpful to format the code appropriately. You can use the “Preformatted Text” button on your highlighted code, or you can put 3x backticks on a line before and after your code.

1 Like

I don’t think you’re providing the SAS token properly. Why have you got sv= in there?

sv which references the version of the storage API to use is followed by a date, and is part of the token itself. It doesn’t appear at the start of the token.

Reading your code, you’re passing the token as something like sv=sp=r&st=... whereas it should just start with the access rights sp=r&st=...

Edit: actually, seeing some examples including the linked docs do start with sv= - although the test SAS I generated and the examples I was looking at on Microsoft Learn do not.

So, updating my comment to suggest that if your token doesn’t already have sv= in it, and you’re adding it manually, make sure it’s followed by a valid date.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.