How to migrate lightning fast from on-premise file server to Azure Fileshare with AZCopy

When you want to migrate from an on-prem file server to an Azure File Share, you want to do it as fast as possible. There are multiple ways to achieve such an migration. This could be with Azure Storage Explorer, mount the SMB share and go for a traditional migration like xcopy, or we can use AzCopy to perform the migration. In this manual I will be showing you how to copy the files, but also to run a delta copy.

image 22

On of the advantages of AzCopy is that there is no bandwidth limit to ingest the copied data. As you can see above I reached the full 1Gbit of my ISP connection. By default, the sync command compares file names and last modified timestamps, making it critical to have your system time synced with the internet time zone. Before we can start, let’s make sure to have the following requirements:

Prerequisites:

STEP 1: Get Shared Access Signature

Before we are going to copy the data, we will need to create a Shared Access Signature to get access to the file shares. From the target Storage Account go to Shared access signature, and make sure to check the boxes under Allowed resource types. For security purposes provide an end data for the key to be valid. Ideally give it an end date just past your intended migration date.

Last, make sure to add the Public IP adres of the fileservers internet provider.

image 23

Now copy the File service SAS URL.

image 28

STEP 2: Create the script:

Now copy the AzCopy file that you downloaded to your on-prem file server. For this manual I saved it on the D: drive.

Now we are going to create the the command to synchronize the data. To following syntax can be used:

azcopy sync '<local-directory-path>/' 'https://<storage-account-name>.blob.core.windows.net/<File Share>/<File service SAS URL>' --recursive

To give you an example, the command should look like this, I copied my State of Trance music files for this manual 😉 . Make sure to end your URL with a backslash, and your target URL with a forward slash.

.\azcopy.exe sync "E:\Music\ASOT\" "https://demoazcopy2azure.nl.file.core.windows.net/azcopydemo/?sv=2022-11-02&ss=bfqt&srt=sco&sp=rwdlacupiytfx&se=2023-12-29T04:08:22Z&st=2023-11-24T20:08:22Z&spr=https&sig=zshrstyyctujfuk75dthdr5rdy5yx9B661paYNA%3D" --recursive

When you want to run the command, keep the following options in mind, I recommend to use them carfully:

–recursive
Will sync all folders and subfolders when entered. Enabled by default with the Sync command.

–preserve-smb-permissions=[true|false]
Copy access control lists (ACLs) along with the files.

–preserve-smb-info=[true|false]
Copy SMB property information along with the files.

–delete-destination=[true|false|prompt]
When true it will delete files that have been deleted on the source location. When you choose prompt you will have to confirm the deletion of the files

–exclude-path
Exclude files based on a pattern.

–log-level=[WARNING|ERROR|INFO|NONE]
Specify how detailed you want your sync-related log entries to be.

Detailed list of all options can be found here: https://learn.microsoft.com/en-us/azure/storage/common/storage-ref-azcopy-sync#options

Result of the command

When you run the sync, you will see a status like this:

image 22

Deleted objects will look like this:

image 27

Troubleshooting:

Storage Account key access disabled:

Go to Settings, and enable Allow storage account key access

image 26

Add a Comment

Your email address will not be published. Required fields are marked *