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:


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><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\" "" --recursive

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

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

Copy access control lists (ACLs) along with the files.

Copy SMB property information along with the files.

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 files based on a pattern.

Specify how detailed you want your sync-related log entries to be.

Detailed list of all options can be found here:

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


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 *