Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

azure-storage-azcopy doesn't work with the SAS token.

Thomas Beauvais
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 13, 2020

It seems like it is not parsing correctly which could be a problem of azcopy itself https://github.com/Azure/azure-storage-azcopy/issues/122 or the "pipe" itself. 

I have tried several different date formats.

&se=2028-01-01
&se=2039-01-01T08:00:00Z

Yet, there is still an error.

   AuthenticationErrorDetail: se is mandatory. Cannot be empty.

Using the exact same command and SAS token locally works perfectly.

The PUT URL it creates doesn't have the `se` query parameter though it's the SAS token!

 PUT https://xyz.blob.core.windows.net/$web/robots.txt?sig=-REDACTED-&sp=rwdlacu&spr=https&srt=o&ss=b&sv=2017-07-29&timeout=901

 

 

 

1 answer

0 votes
Halyna Berezovska
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 31, 2020

@Thomas Beauvais it seems like it is azure issue, because our pipe only copies and if the token is not validated by azure, it is either token or azure problem. Our tokens generated are working properly.

However, haven't you tried to generate sas token via azure portal?

Thomas Beauvais
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 1, 2020

Thanks for the reply. 

The trouble is that the azcopy CLI (10.5.0) works with the same token (sorry that I failed to mention that).

The token I am using is in the format of the console. The discrepancy seems like it is in some transform somewhere or a version mismatch.

Halyna Berezovska
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 3, 2020

@Thomas Beauvais try, please, the next command for generating the token

 

 az storage container generate-sas --name <container_name> --account-name <storage_account_name> --expiry ${SAS_TOKEN_EXPIRY} --permissions ${PERMISSIONS} | sed 's/["\t]//g
where PERMISSIONS is 'rw', for example or other permissions you would l like to have,
and sas token expire date, for example, can be :
SAS_TOKEN_EXPIRY=$(date -d "60 minutes" '+%Y-%m-%dT%H:%M:%SZ')

 

I suspect, removing \t, it worked for me. I think, It is that specific way how azcopy works with token in shell (depending on shell), because sometimes they do not ignore some spaces etc.

Using rest api is more complicated here, but you could try also to use sed for the token in some way after executing PUT.

Looking forward to hearing back.
Halyna Berezovska
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 3, 2020

also you can refer to examples, azure is recommending to use https://docs.microsoft.com/en-us/cli/azure/storage/container?view=azure-cli-latest#az-storage-container-generate-sas-examples ,

but I think still attention to spaces , \t, \n etc. should be paid

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events