Az copy remove files is failing - azure

The azcopy to remove files failed when I tried to remove a folder with subfolders and files from a fileshare with azcopy v10.
My az copy command was as follows
azcopy rm https://<storage-account-name>.file.core.windows.net/<file-share-name>/SystemScheduledJobs-22-06-01?<sas-token> --recursive=true
The error which I was getting is
panic: inconsistent path separators. Some are forward, some are back. This is not supported.
and the stack trace
goroutine 565 [running]:
github.com/Azure/azure-storage-azcopy/v10/common.DeterminePathSeparator({0xc0071c6d00, 0x3e})
/home/vsts/work/1/s/common/extensions.go:140 +0x97
github.com/Azure/azure-storage-azcopy/v10/common.GenerateFullPath({0x0, 0x0}, {0xc0071c6d00, 0x3e})
/home/vsts/work/1/s/common/extensions.go:155 +0xe5
github.com/Azure/azure-storage-azcopy/v10/common.GenerateFullPathWithQuery({0x0, 0x248f909e0be}, {0xc0071c6d00, 0xb85c3d}, {0x0, 0x0})
/home/vsts/work/1/s/common/extensions.go:172 +0x34
github.com/Azure/azure-storage-azcopy/v10/ste.(*JobPartPlanHeader).TransferSrcDstStrings(0x248f8ec0000, 0x1853)
/home/vsts/work/1/s/ste/JobPartPlan.go:181 +0x28f
github.com/Azure/azure-storage-azcopy/v10/ste.(*jobPartMgr).ScheduleTransfers(0xc000029500, {0x17c3190, 0xc0005b2000})
/home/vsts/work/1/s/ste/mgr-JobPartMgr.go:418 +0x692
github.com/Azure/azure-storage-azcopy/v10/ste.(*jobMgr).scheduleJobParts(0xc0007a3880)
/home/vsts/work/1/s/ste/mgr-JobMgr.go:851 +0x3e
created by github.com/Azure/azure-storage-azcopy/v10/ste.NewJobMgr
/home/vsts/work/1/s/ste/mgr-JobMgr.go:180 +0x9a6
I would be really grateful if anyone could provide more insight into this issue.

I tried to reproduce in my environment using the powershell command I got result successfully.
Powershell command
azcopy rm https://<storage-account-name>.file.core.windows.net/<file-share-name>/<path>?<sas-token> --recursive=true
Output:
*FileShare Url (https://<storage-account-name>.file.core.windows.net/<file-share-name>/<path>)
SAS Token at Storage Account level..
kindly check once with path in your url and try to reproduce once again.
Reference:
azcopy remove | Microsoft Docs

Related

azcopy failed to perform copy command due to error: cannot use directory as source without --recursive or a trailing wildcard (/*)

Trying to copy a .vhd between two different storage accounts using SAS. Getting error. Can someone give me a hand please? thank you much
azcopy cp 'https://mystorage.blob.core.windows.net/images/MyDisk.vhd?sv=2019-12-12&ss=bfqt&srt=c&sp=rlx&se=2021-03-12T12:49:12Z&st=2021-02-14T04:49:12Z&spr=https&sig=oahRM1xDHkjgtEo5OjUv64vSPIjI%2BvyqVmdGN9demJc%3D' 'https://1sddq9uificcrb0t.blob.core.windows.net/vhds/MyDisk.vhd?sv=2019-12-12&ss=bfqt&srt=sco&sp=rwdlacupx&se=2021-03-13T01:02:49Z&st=2021-02-14T17:02:49Z&spr=https&sig=BXBocHkS%2FofwkhgdsvYccPEh0EA6Fpcu0LZd19%2FGwqw%3D'
Returning this error:
INFO: Scanning...
failed to perform copy command due to error: cannot use directory as source without --recursive or a trailing wildcard (/*)
It seems that you copy the VHD file of the disk to another storage account. You could try the command like this without .vhd suffix.
azcopy cp 'https://mystorage.blob.core.windows.net/images/abcd?sv=2019-12-12&ss=bfqt&srt=c&sp=rlx&se=2021-03-12T12:49:12Z&st=2021-02-14T04:49:12Z&spr=https&sig=oahRM1xDHkjgtEo5OjUv64vSPIjI%2BvyqVmdGN9demJc%3D' 'https://1sddq9uificcrb0t.blob.core.windows.net/vhds/abcd?sv=2019-12-12&ss=bfqt&srt=sco&sp=rwdlacupx&se=2021-03-13T01:02:49Z&st=2021-02-14T17:02:49Z&spr=https&sig=BXBocHkS%2FofwkhgdsvYccPEh0EA6Fpcu0LZd19%2FGwqw%3D'
Or you can append the --recursive at the end of your command.

Trying to use azcopy for copying file from storage account

Uploaded a .sh file into storage account and trying to get that into rhel vm. I have azcopy version 10.6.1. Command i am using azcopy copy ā€¯https://.blob.core.windows.net/container/test.sh>[SAS token]" . When i run this, it is moving to next line and giving this ">" output. Tried to do in many ways but no luck.
How can we troubleshoot this issue?
The syntax to use "azcopy copy" command is
azcopy copy [source] [destination] [flags]
To download a single file by using a SAS token:
azcopy cp "https://[account].blob.core.windows.net/[container]/[path/to/blob]?[SAS]" "/path/to/file.txt"
To download a single file by using a SAS token and then piping the output to a file (block blobs only):
azcopy cp "https://[account].blob.core.windows.net/[container]/[path/to/blob]?[SAS]" > "/path/to/file.txt"
This is the source of above information.
Related references:
Download blobs from Azure Blob storage by using AzCopy v10
Troubleshoot Azcopy related issues

Download the files in azure using azcopy

I am trying to download the files from the blod container in azure...But its showing Error: Unknowncommand
Cmd:
AzCopy https://forecast.blob.core.windows.net/test C:\Users\Shwettha\Downloads\azcopyfiles /sourceKey:sp=rl&st=2020-07-17T12:17:25Z&se=2020-12-31T21:30:00Z&sv=2019-10-10&sr=c&sig=z9b0X4vT6DGy6zOGNffM5FVaK5jNGOTeFFWD /S /V:C:\temp\logs\azcopy.log
error:
Error: unknown command "https://forecast.blob.core.windows.net/test" for "azcopy"
I also tried
azcopy cp "https://forecast.blob.core.windows.net/test/apollo?si=Utopus&sv=2019-12-12&sr=c&sig=qHv1ojyG2hrjrq7ZQ%2BMAVZhkpCwrXs1" "utopus/apollo/forecast/dayahead" --recursive
Error: is not recognized as an internal or external command,
operable program or batch file.
Can anyone pls help me...to downlaod or list the files in the blob.
iam new to azcopy
Have tried below command
azcopy cp "https://forecast.blob.core.windows.net/test/apollo?si=Utopus&sv=2019-12-12&sr=c&sig=qHv1ojyG2BMAVZhkpCwrXsD" "c:/Users/Shwettha/Downloads/azcopyfiles" --recursive
It seems that you're trying to copy the contents of directory to local.
Here's something you need to check:
1.the version of your azcopy
2.Open your cmd in your computer, and navigate to the location where the azcopy.exe is.
3.the sastoken you're using, please follow the screenshot below to generate the sastoken(In azure portal):
4.suppose you have a blob container named test8, and the container has a directory named ccc. now if you want to download all the blobs inside the directory ccc, please use the command below:
azcopy cp "https://yy1.blob.core.windows.net/test8/ccc?your_sastoken" "d:\bbb" --recursive
Here is the screenshot:

Azcopy: Copying files to an Azure Fileshare using Azcopy 10

I'm trying to copy files to and from an Azure Fileshare using AZCopy v10. I have had this successfully working using v8.1 but I keep getting errors using v10.
From the command line I'm using this to copy a file from the local drive to the fileshare;
c:\Temp\azcopy.exe copy "c:\temp\sample.txt" "https://myfiles.file.core.windows.net/dbfiles/sample.txt?SASKeyText"
This generates the error message;
failed to perform copy command due to error: cannot transfer individual files/folders to the root of a service. Add a container or directory to the destination URL
I have tried adding a directory to the fileshare and adding that to the command string but I get the same error.
If I reverse the copy from the fileshare to the local drive I get the error;
failed to perform copy command due to error: account copies are an inherently recursive operation, and thus --recursive is required
I have followed the guide at https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-files but haven't been able to see what's wrong.
Thanks in advance for any help.
The error here was with the SAS token and not the form of the command.
I suppose this should be marked up amongst examples of unhelpful error messages.
Thanks to everyone who took the time to have a look.
I had this same issue when trying to do a copy from my local machine to Azure Blob storage.
This was the command I was running:
azcopy copy --from-to=LocalBlob "C:\AzureStorageTest\my-app\*" "https://myapptest.blob.core.windows.net/%24web" --recursive
But I got the error below:
failed to perform copy command due to error: cannot transfer individual files/folders to the root of a service. Add a container or directory to the destination URL
Here's how I solved it:
I was missing the ?[SAS] argument at the end of the Blob storage location. So instead of this:
azcopy copy --from-to=LocalBlob "C:\AzureStorageTest\my-app\*" "https://myapptest.blob.core.windows.net/%24web" --recursive
I had this:
azcopy copy --from-to=LocalBlob "C:\AzureStorageTest\my-app\*" "https://myapptest.blob.core.windows.net/%24web?[SAS]" --recursive
Note:
The format is azcopy copy "/path/to/dir" "https://[account].blob.core.windows.net/[container]/[path/to/directory]?[SAS]" --recursive. You only need to modify the "/path/to/dir", [account] and [container]/[path/to/directory]. Every other thing remains the way they are.
Specify the source-destination routing using the --from-to=LocalBlob (if you're copying from local to blob storage) argument to be explicit about the copy operation.
My actual Blob storage location is https://myapptest.blob.core.windows.net/$24web but I used https://myapptest.blob.core.windows.net/%24web, since $ will throw some error when used, so %24 was used.
That's all.
I hope this helps
Here is a sample azcopy script which worked for me
az storage azcopy blob upload
-c'https://$AZURE_STORAGE_ACCOUNT_NAME.blob.core.windows.net/\\\$web' \
--account-name $AZURE_STORAGE_ACCOUNT_NAME \
-s "build/*" \
--account-key $AZURE_STORAGE_ACCOUNT_ACCESS_KEY \
--recursive
If you get this error while trying to copy to $web container:
"failed to perform copy command due to error: cannot transfer individual files/folders to the root of a service. Add a container or directory to the destination URL"
Per a solution listed here, we need to add an escape character (\) before $web. Following command (to copy all files and subfolders to web container) worked for me:
azcopy copy "<local_folder>/*" "https://******.blob.core.windows.net/\$web/?<SAS token>" --recursive
Without the escape character, the following command fails with the above error.
azcopy copy "<local_folder>/*" "https://******.blob.core.windows.net/$web/?<SAS token>" --recursive

Azure Data Lake Store data upload using az dls fs upload command

From a particular shell script i'm trying to upload a set of folders.
The folder structure is as below:
parentfolder/folder1
parentfolder/folder2
So from the parentfolder i'm doing a
for directory in `find . -type d`
and finding the list of folders and doing a
az dls fs upload --account $adls_account --source-path $new_src_dir --destination-path $dest_dir$file_name --overwrite --thread-count $thread_count --debug
However, i'm facing one issue while the upload is happening. After the first upload is complete, it throws error saying:
Please run 'az account set' to select active account.
Failure in uploading file to Data Lake Store
can some please help me find the actual error. I've done the az_login and then started the for loop.
Thanks,
Arjun
Please try run this command az account set --subscription <name or id>, then run your script.

Resources