Microsoft Azure has an offering called Azure File Sync, which allows the synchronization of on-premises file servers with Azure Files supported by Storage Accounts. There are several benefits of using this approach — it could be used for transition between on-premises and cloud, backup, and disaster recovery. One thing in common on all these scenarios is the ability to move your file server data to the cloud and reduce costs on-premises by removing backup requirements, disaster recovery, or eliminating the file server all together.
Azure File Sync can be used as a transition tool to move file server data to the cloud, but also as a synchronization tool to keep more than one server synchronized without the use of DFS or any other replication technology. Last but not least, we can leverage the cloud and use tiering, where unused files on the local file servers can be moved to Azure Files and a local reference of the file stays locally. For the end-user it is a transparent process and no additional tools are required.
The process to use Azure File Sync comprises three steps: configure the service in Microsoft Azure, install the agents, and configure the replication.
In this article, we will cover these basic steps and make sure that all data from our file server is in a resilient and redundant cloud storage solution.
A simple scenario
To understand better how Azure File Sync works, let’s create a simple scenario where we have a File Server on-premises called TORFS01 and we have a Public shared folder. For this article it is located on C:\home\public (in a production environment it must be located in a different disk other than the operating system volume). We added some pictures and a new folder in the share, as depicted in the image below (please note that we are accessing that information through UNC path.)
Creating the Storage Account
Before creating the Azure File Sync, we need to prepare a Storage Account that will receive all data from the File Servers on-premises. From the design perspective, it is highly recommended to use a GRS (Geo-Redundant Storage which uses the three local replicas + three additional replicas in another region) to make sure that all data that is being synchronized to the cloud does not have a single point of failure.
In this article, we will be creating a Storage Account called techgenix and we will use Storage V2 (general purpose v2) account, and Standard performance (magnetic disks, low cost). After making all decisions, click on Create.
After creating the Storage Account to support the upcoming Azure File Sync, our next step is to replicate the share structure that we have on-premises in the Storage Account/Files. Based on our scenario, we will be replicating a shared folder called Public and we will be creating a Shared Folder called public and we will set the Quota to 4096GB.
Creating the Azure File Sync
Logged on the Azure Portal, click on New Resource, and type in File Sync, and select Azure File Sync from the list. In the initial blade, a short summary of the service will be described, click on Create.
Click on Create. In the new blade, we need to define the name for the Azure File Sync, Resource Group, and location. After making the decision, click on Create button to complete the process and wait for the provision to be completed.
Configuring the server endpoints
The first step on the server where we are going to install the Storage Sync Agent is to make sure that the AzureRM module is installed. Using the following PowerShell cmdlet we can install the module. A few confirmations to install additional software from unknown repositories will be requested, so please confirm when necessary.
If the AzureRM is already present on your server, run Update-Module AzureRM just to confirm that the latest modules are in place.
The second step is to download and install the Storage Sync Agent, which can be retrieved from this link here, and a link with the latest bits is also available on the Registered Servers item of Azure Sync Service in the Azure Portal.
The download has to be done per operating system. Nowadays, we have a version for 2012 R2 and 2016. Select the version based on your operating system, download and execute the file.
The entire installation process does not require any special configuration — use default values to complete the installation, and it shouldn’t take more than a couple of minutes.
After the installation is complete, Azure File Sync will open automatically. In the first run it will check for an update on the agent that we have just installed (it was one of the selected options during the installation to check for updates). If there are no updates, click on OK to move forward.
In the Sign in and register this server page, click on Sign in button and provide your credentials to access Microsoft Azure (a new page will be open, go through the authentication process and when it is complete you will return automatically to the same wizard).
In the Choose a Storage Sync Service page, we need to select the subscription, resource group, and Storage Account and we will use the ones that we have just created in the previous step. If everything goes well, a Registration Successful! page will be displayed. Click on OK.
The result of that operation will be the server showing up on the Registered Servers in the File Sync service, as depicted in the image below.
Creating a Sync group
So far we created the requirements on both sides of the fence: on-premises and Azure to support the file synchronization. What glues them together is the Sync group where we define server endpoints and cloud endpoints, and after that is just matter of time to let them replicate and keep the synchronization.
Open the Azure File Sync resource in Microsoft Azure portal, click on Sync groups, and to start the creation of a new one click on + Sync Group button located at the top of the new blade on the right side. In the new blade, define a name for the Sync Group, and define the cloud endpoint, which is comprised of the Subscription, Storage Account, and File Share (which was created prior to this wizard).
After creation, we will have a Sync Group with one cloud endpoint that we have just configured, and our next task is to add server endpoints, and we can do that by hitting the Add server endpoint button. Select the registered server and the path from where we want to synchronize the data. Click on Create.
The result will be a Sync Group with one cloud endpoint and one server endpoint and its status, in our case shows health, which is a good sign.
After getting a health status, we can check the Storage Account, and under the File Share that we created to support the synchronization, we can validate that all data that we have on-premises is being synchronized.
If you are planning to move your File Server data to Microsoft Azure, you must check Azure File Sync and use it to create a smooth transition from on-premises to the cloud without impacting users and applications.
Featured image: Shutterstock