Answered by:
Azure File storage SAS TOKEN

Question
-
I am able to upload files to ADLS Gen 2 blob storage with AZcopy through oauth authorization, But i am unable to upload to file storage with the same . It is asking for SAS token. Please tell me the process of generating SAS token. Thanks.
- Edited by SANB1 Monday, August 19, 2019 3:05 PM
Monday, August 19, 2019 2:01 PM
Answers
-
Hi San,
You can generate the SAS token: Settings => Shared access signature => Select the options required and click on generate SAS and connection string and copy the SAS token.
To learn more about SAS tokens and how to obtain one, see Using shared access signatures (SAS).
Use only the latest version of AzCopy (AzCopy v10):
Option1: Use Azure AD
Download a single file using OAuth authentication. Please use 'azcopy login' command first if you aren't logged in yet:
azcopy cp "https://[account].blob.core.windows.net/[container]/[path/to/blob]" "/path/to/file.txt"
Upload a single file with a SAS:
azcopy cp "/path/to/file.txt" https://[account].blob.core.windows.net/[container]/[path/toblob]?[SAS]
Option2: Use a SAS token
You can append a SAS token to each source or destination URL that use in your AzCopy commands.
This example command recursively copies data from a local directory to a blob container. A fictitious SAS token is appended to the end of the of the container URL.
azcopy cp "C:\local\path" "https://account.blob.core.windows.net/mycontainer1/?sv=2018-03-28&ss=bjqt&srt=sco&sp=rwddgcup&se=2019-05-01T05:01:17Z&st=2019-04-30T21:01:17Z&spr=https&sig=MGCXiyEzbtttkr3ewJIh2AR8KrghSy1DGM9ovN734bQF4%3D" --recursive=true
Hope this helps.
- Proposed as answer by CHEEKATLAPRADEEP-MSFTMicrosoft employee Tuesday, August 20, 2019 5:22 AM
- Marked as answer by SANB1 Tuesday, August 20, 2019 2:41 PM
Tuesday, August 20, 2019 5:22 AM
All replies
-
It appears that Azure AD authentication only supports blob and queue storage right now. You can use Azure File storage and Azure AD with domain joined VMs which is in preview. You can read more here:
https://docs.microsoft.com/en-us/azure/storage/common/storage-auth-aad
Monday, August 19, 2019 8:09 PM -
Hi Steve, Its working for me with AZcopy command with SAS token. Find the below command I am using for uploading files from onpremise to Azure file storage.
azcopy cp "C:\BI_Dropbox\MissionToDataHub\*" "https://mycontainer.file.core.windows.net/sharedtables/?SASTOKENID"
Please let me know if it has any down sides int the long term or any other issues.
Thanks.
san
Monday, August 19, 2019 9:51 PM -
Hi San,
You can generate the SAS token: Settings => Shared access signature => Select the options required and click on generate SAS and connection string and copy the SAS token.
To learn more about SAS tokens and how to obtain one, see Using shared access signatures (SAS).
Use only the latest version of AzCopy (AzCopy v10):
Option1: Use Azure AD
Download a single file using OAuth authentication. Please use 'azcopy login' command first if you aren't logged in yet:
azcopy cp "https://[account].blob.core.windows.net/[container]/[path/to/blob]" "/path/to/file.txt"
Upload a single file with a SAS:
azcopy cp "/path/to/file.txt" https://[account].blob.core.windows.net/[container]/[path/toblob]?[SAS]
Option2: Use a SAS token
You can append a SAS token to each source or destination URL that use in your AzCopy commands.
This example command recursively copies data from a local directory to a blob container. A fictitious SAS token is appended to the end of the of the container URL.
azcopy cp "C:\local\path" "https://account.blob.core.windows.net/mycontainer1/?sv=2018-03-28&ss=bjqt&srt=sco&sp=rwddgcup&se=2019-05-01T05:01:17Z&st=2019-04-30T21:01:17Z&spr=https&sig=MGCXiyEzbtttkr3ewJIh2AR8KrghSy1DGM9ovN734bQF4%3D" --recursive=true
Hope this helps.
- Proposed as answer by CHEEKATLAPRADEEP-MSFTMicrosoft employee Tuesday, August 20, 2019 5:22 AM
- Marked as answer by SANB1 Tuesday, August 20, 2019 2:41 PM
Tuesday, August 20, 2019 5:22 AM