Azure User Group Nepal

Learn and understand the cloud technology using Microsoft Azure platform to adopt it

Azure File Sync

Author: Sakaldeep

December 09, 2017

Azure File Sync is a cloud service from Microsoft Azure. It synchronizes your on-premises file server to theAzure File which will give you a flavor of hybrid file server between organization’s on-premises file server (Server Endpoint) and Azure File (Cloud Endpoint).

Azure File Sync will synchronize your Azure File share with your on-premises Window Servers. The real magic of Azure File Sync is the ability to tier files between your on-premises file server and Azure Files. This enables you to keep only the newest and most recently accessed files locally without sacrificing the ability to see and access the entire namespace through seamless cloud recall. With Azure File Sync, you can effectively transform your Windows File Server into an on-premises tier of Azure Files.

First things first, you will provision a Windows VM which will be an on-premises file server. You will also create Azure File Share which will act as a centralize containers of files. Finally, you will configure Azure File Sync service to sync the files from the VM to Azure File Share.

Create a File Server

Let’s provision a Windows VM (Virtual Machine) that will act as an on-premises file server. You will prepare the server to act as a file server such as creating a shared folder.

  1. Click Virtual Machines, and then click Add.

  2. Choose a Windows Server 2016 Datacenter image and click the Create button.

  3. Specify the following configuration:

  • Name: Fileserver01
  • User name: demouser01
  • VM type: HDD
  • Resource Group:DemoRG
  • Location: Choose a region

In the next step, choose VM size followed by default settings such as virtual network, subnet, storage account, and security group. Virtual machine (VM) will be spined off with mentioned configurations.

  1. Check the box Pin to dashboard and click Create to create the virtual machine.

More Info: Virtual Network, Subnet and Security Group

Before creating VM you need to spend time in designing resource group, storage account, virtual network, subnet, and security group. Once your VM will be created you cannot easily move the VM to another network. Design of network architecture should be considered before creating VM in the production environment.

Create a Shared Folder

In this task, you will create a shared folder on the file server and will keep some dummy data in the folder.

  1. After the virtual machine is created, open my computer and make a folder called Mydata and put files.

More Info: File Server Preparation for Azure File Sync Agent Installation

In the next exercise, you will install Azure File Sync Agent on this VM. Prepare the server for smooth agent installation as below: Disable Internet Explorer Enhanced Security Configuration. This is required only for initial server registration. You can re-enable it after the server has been registered. Ensure that you are running at least PowerShell 5.1.* (PowerShell 5.1 is the default on Windows Server 2016). You can verify that you are running PowerShell command $PSVersionTable.PSVersion.

Summary

In this exercise, you created an on-prem file server and a shared folder with some files inside.

Create an Azure File Share and Configure Azure File Sync

In this exercise, you will create an Azure File Share (Cloud Endpoint) in Azure File which will act as a global file share. Files from the multiple on-premises file server will be stored in the file share. Azure File share is an SMB share. After that, you will configure Azure File Sync service to synchronize on-prem file share to Azure file.

Create a File Share in Azure File

In this task, you will create a file share in Azure File. Azure Files is also known as Common Internet File System (CIFS). Azure File is one of the components of the Azure Storage Account, first, you will create Storage Account.

  1. Click More Services and then search for Storage Account and click the Storage Account result.

  2. Click Add to create a new storage account that will be used for creating a file share.

  3. Specify the following configuration and click OK.

  • Name: azurefilesyncsa
  • Storage type: General Purpose
  • Replication: LRS
  • Secure Transfer Required: Disabled
  • Resource Group: DemoRG
  • Location: the same region for resource group
  1. Check the box Pin to dashboard and click Create to create the virtual network.

  2. Storage account has created which can be located in Storage Account. Click azurefilesyncsa storage account which you have created.

  3. Click on Overview then click on Files to create a share.

  4. Click on File Share to add new file share.

  5. Specify the following configuration and click OK.

  • Name: azureshare
  • Quota: 100

More Info: Azure File Share

Azure File share can store an unlimited number of files, up to the 5 TiB total capacity of the file share. A file may be up to 1 TiB in size. Azure Files offers two convenient data access methods that you will see in next exercise.

Configure Azure File Sync

In this task, you will configure the Azure file Synchronization service. Azure File Sync provides:

  • Multi-site access: provide write access to the same data across Windows Server and Azure Files.
  • Cloud Tiering: store only recently accessed data on the local server
  • Integrates with Azure Backup: no need to back up your data on-premises.
  • Rapid DR: restore file metadata immediately and recall data as needed.
  1. Click More Services and then search for Azure File Sync and click the Azure File Sync result.

  2. Click Create to create an Azure File Sync service.

  3. Specify the following configuration and click OK.

  • Name: AzureFileSync01
  • Resource Group: DemoRG
  • Location: the same region for resource group
  1. Click on AzureFileSync01 and navigate to Register Server to register the file server. Click on Azure Storage Sync Agent to download and install the agent.

    The registered server has a trust relationship between the server and the Storage Sync Service. You can register as many servers to a Storage Sync Service instance as you want. However, a server can be registered with only one Storage Sync Service at a time.

  2. Click on NextAccept the Licence AgreementSpecify Installation Path and follow the wizard to complete the setup.

    The Azure File Sync agent enables Windows Server to be synced with an Azure file share. The Azure File Sync agent has three main components:FileSyncSvc.exe: StorageSync.sys: and PowerShell management cmdlets.

  3. Click on Finish to complete the setup.

  4. The AzureRM module is prerequisite to install the agent.

  5. Install AzureRM Module by command Install-Module AzureRM and retry the installation.

  6. After the successful installation of the agent, click on Sign in and provide Azure subscription credential to log in. 

  7. After Sign in select Azure SubscriptionResource GroupStorage Sync Service and click on Register 

  8. After successful registration of the file server, verify it on the Azure portal under Registered Servers. A sync group defines the sync topology for a set of files. Endpoints within a sync group are kept in sync with each other. 

  9. Click on Overview then Sync group to create sync group to synchronize on-prem file server and Azure file share. 

  10. Specify the following configuration.

     

  • Sync group name: DemoAzureFileSybcGroup
  • Storage account: Select Storage Account
  • Azure file share: Select Azure file share
  1. Azure file sync group has created. 
  2. Click on Add server endpoint to add the file server to the sync group. You can see there is one cloud endpoint and zero server endpoint. After adding the server endpoint in the next step, server endpoint well appear. 
  3. Specify the configuration
  • Server name: FIleserver01
  • Path: C:\Mydata
  • Cloud Tiering: Disabled
  1. After adding the server endpoint, Azure File Sync will start replicating files from on-premises to cloud and will appear as shown in below image.

     

More Info: Azure File Sync

Azure File Sync is a multi-master sync solution for Azure File Share. It replicates data between Azure File shares and servers anywhere in the world. Azure File Sync has Sync Group to manage the locations that would be kept in sync with each other. Every Sync Group has one cloud endpoint, which represents an Azure File share, and one or more server endpoints, which represents a path on a Windows Server. Within a Sync Group, everything will be sync automatically.

Azure File Sync also helps you leverage Azure to get control over your on-premises data. Since cloud tiering moves old and infrequently accessed files to Azure, it effectively helps you make unpredictable storage growth predictable. When disasters strike, Azure File Sync can help. Simply set up a new Windows Server, install Azure File Sync, and the namespace is nearly instantly synced down as your cache is rebuilt.

Summary

In this exercise, you have created Storage Account, Azure File, Azure File Share and configure Azure File Sync service (register server endpoint, agent installation, sync group creation) which is replicating files between on-prem and cloud.

Accessing the Synchronized Files

In this exercise, you will access the replicated/synchronized files from the new file server that can be anywhere in the world. You will also access the file using a network drive.

To access files from Azure File Share to the on-premises file server either you have to mount it manually using a command like NET USE or have to use Azure File Sync Agent that will replicate the files automatically (bi-direction). Azure File Sync provides flexibility, better performance, and compatibility of an on-premises file server. Azure File Sync transforms Windows Server into a quick cache of your Azure file share. You can use any protocol that’s available on Windows Server to access your data locally, including SMB, NFS, and FTPS.

Access Synchronized File from New File Server

  1. Assume your existing file server has crashed or you are adding a new file server to a new office that needs entire files from the previous file server. Setup new file server and configure it to the Azure File Sync, it will sync metadata namespace immediately and cache it locally. Install Azure File Sync Agent on the new file server (refer the previous lab for agent installation) and Register to the Sync Group. Click Sign in and provide credentials.

  2. Choose Azure SubscriptionResource Group, and Storage Sync Service and click on Register

  • Azure Subscription: Choose from the dropdown
  • Resource Group: DemoRG
  • VM type: AzureFileSync01

Switch to the Azure portal and verify that a new file server has registered. After that add server endpoint.

  1. The new file server will appear under Registered Servers

  2. Click Sync groupsDemoAzureFileSyncGroup, and Add server endpoint to add new server endpoint.

  3. Specify the following configuration and click Create

  • Registered Server: Fileserver02
  • Path: C:\Mydata
  1. New server endpoint (Fileserver02) has added.

  2. Empty folder Mydata on Fileserver02, file from Azure File Share will be replicated here.

  3. The file has replicated from File Share to the new file server. 

More Info: Azure File Sync

With Azure File Sync, shares can be replicated to Windows Servers on-premises or in Azure. Users would access the file share through the Windows Server, such as through an SMB or NFS share. This is useful for scenarios in which data will be accessed and modified far away from an Azure datacenter, such as in a branch office scenario. Data may be replicated between multiple Windows Server endpoints, such as between multiple branch offices.

Mount Azure File Share as a Network Drive

In this task, you will mount Azure File Share as a network drive in any server where you want to access the files.

  1. Click Storage AccountazurefilesyncsaFile serviceazureshare and click Connect

  2. Copy the PowerShell command from the portal. Network drive name will be Z.

  3. Log in to the server and run PowerShell as an Administrator and run paste the command that you have copied in the previous step.

  4. Network drive Z has successfully mounted.

  5. Double click Z Drive to access the files.

More Info: Azure File Mount

Any Azure File share can be mounted by Windows, macOS, and/or Linux with the industry standard Server Message Block (SMB) protocol or via the File REST API. With SMB, reads and writes to files on the share are made directly on the file share in Azure. To mount by a VM in Azure, the SMB client in the OS must support at least SMB 2.1. To mount on-premises, such as on a user’s workstation, the SMB client supported by the workstation must support at least SMB 3.0 (with encryption). The Linux SMB3 client doesn’t support share level encryption yet, so mounting a file share in Linux only works from virtual machines running in the same Azure region as the file share.

When connecting from a computer from outside Azure, remember to open outbound TCP port 445 in your local network. Some Internet service providers may block port 445. Check with your service provider for details.

Total visits : 50