Today we will learn on how to copy files from on-premise to Azure Blob Storage (ADLS) using AzCopy
Pre-Requisite:
- Download AzCopy utility from here (microsoft site)
- Install the AzCopy.exe in the machine that you'll be using to run the copy commands
- Open the Azcopy command line utility and start writing the commands
- Authenticate a user identity:
- Use the script in CMD to authenticate your identity.
- Replace the <tenant-id> placeholder with the tenant ID of the organization to which the storage account belongs. To find the tenant ID, select the Azure Active Directory > Properties > Directory ID in the Azure portal.
- Eg.: azcopy login --tenant-id = 5dasda9fa7da79da7-abec-4505-81ea6-8csda2
- Open the website
- Provide the code
- Click Next button
- A Sign-in window will appear.
- Sign-in using your azure account credentials
- After you've successfully signed in, you can close the browser window and begin using AzCopy
2. To copy files from On-prem location to ADLS, use the below command:
- azcopy sync " <Select-folder-path>" "https:// <storage-account-name>/ <container-name> <SAS Token>" --recursive=true
Note: Please use double quotation for file path if you’re using Windows machine.
- AzCopy sync will start a non-stop copy process where AzCopy will keep on copying the files unless manually terminated.
- If you just want to just trigger the process one time, use the copy parameter instead of sync.
Copy single file:
- azcopy cp "/path/to/file.txt" "https://[account].blob.core.windows.net/[container]/[path/to/blob]?[SAS]"
Azcopy is great but ShareGate and Gs Richcopy 360 are more easy and full featured
ReplyDelete