Tutorial: Extend Windows file servers with Azure File Sync

The article demonstrates the basic steps for extending the storage capacity of a Windows server by using Azure File Sync. Although the tutorial features Windows Server as an Azure virtual machine (VM), you would typically do this process for your on-premises servers. You can find instructions for deploying Azure File Sync in your own environment in the Deploy Azure File Sync article.

  • Deploy the Storage Sync Service
  • Prepare Windows Server to use with Azure File Sync
  • Install the Azure File Sync agent
  • Register Windows Server with the Storage Sync Service
  • Create a sync group and a cloud endpoint
  • Create a server endpoint

If you don't have an Azure subscription, create a free account before you begin.

Note

This article has been updated to use the new Azure PowerShell Az module. You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. For Az module installation instructions, see Install Azure PowerShell.

Sign in to Azure

Sign in to the Azure portal.

Prepare your environment

For this tutorial, you need to do the following before you can deploy Azure File Sync:

  • Create an Azure storage account and file share
  • Set up a Windows Server 2016 Datacenter VM
  • Prepare the Windows Server VM for Azure File Sync

Create a folder and .txt file

On your local computer, create a new folder named FilesToSync and add a text file named mytestdoc.txt. You'll upload that file to the file share later in this tutorial.

Create a storage account

To create a general-purpose v2 storage account in the Azure portal, follow these steps:

  1. In the Azure portal, select All services. In the list of resources, type Storage Accounts. As you begin typing, the list filters based on your input. Select Storage Accounts.

  2. On the Storage Accounts window that appears, choose Add.

  3. Select the subscription in which to create the storage account.

  4. Under the Resource group field, select Create new. Enter a name for your new resource group, as shown in the following image.

    Screenshot showing how to create a resource group in the portal

  5. Next, enter a name for your storage account. The name you choose must be unique across Azure. The name also must be between 3 and 24 characters in length, and can include numbers and lowercase letters only.

  6. Select a location for your storage account, or use the default location.

  7. Leave these fields set to their default values:

    Field Value
    Deployment model Resource Manager
    Performance Standard
    Account kind StorageV2 (general-purpose v2)
    Replication Read-access geo-redundant storage (RA-GRS)
    Access tier Hot
  8. Select Review + Create to review your storage account settings and create the account.

  9. Select Create.

For more information about types of storage accounts and other storage account settings, see Azure storage account overview. For more information on resource groups, see Azure Resource Manager overview.

Create a file share

After you deploy an Azure storage account, you create a file share.

  1. In the Azure portal, select Go to resource.

  2. Select Files from the storage account pane.

    Select Files

  3. Select + File Share.

    Select the add file share button

  4. Name the new file share afsfileshare. Enter "1" for the Quota, and then select Create. The quota can be a maximum of 5 TiB, but you only need 1 GB for this tutorial.

    Provide a name and quota for the new file share

  5. Select the new file share. On the file share location, select Upload.

    Upload a file

  6. Browse to the FilesToSync folder where you created your .txt file, select mytestdoc.txt and select Upload.

    Browse file share

At this point, you've created a storage account and a file share with one file in it. Next, you deploy an Azure VM with Windows Server 2016 Datacenter to represent the on-premises server in this tutorial.

Deploy a VM and attach a data disk

  1. Go to the Azure portal and expand the menu on the left. Choose Create a resource in the upper left-hand corner.

  2. In the search box above the list of Azure Marketplace resources, search for Windows Server 2016 Datacenter and select it in the results. Choose Create.

  3. Go to the Basics tab. Under Project details, select the resource group you created for this tutorial.

    Enter basic information about your VM on the portal blade

  4. Under Instance details, provide a VM name. For example, use myVM.

  5. Don't change the default settings for Region, Availability options, Image, and Size.

  6. Under Administrator account, provide a Username and Password for the VM.

  7. Under Inbound port rules, choose Allow selected ports and then select RDP (3389) and HTTP from the drop-down menu.

  8. Before you create the VM, you need to create a data disk.

    1. Select Next:Disks.

      Add data disks

    2. On the Disks tab, under Disk options, leave the defaults.

    3. Under DATA DISKS, select Create and attach a new disk.

    4. Use the default settings except for Size (GiB), which you can change to 1 GB for this tutorial.

      Data disk details

    5. Select OK.

  9. Select Review + create.

  10. Select Create.

    You can select the Notifications icon to watch the Deployment progress. Creating a new VM might take a few minutes to complete.

  11. After your VM deployment is complete, select Go to resource.

    Go to resource

At this point, you've created a new virtual machine and attached a data disk. Next you connect to the VM.

Connect to your VM

  1. In the Azure portal, select Connect on the virtual machine properties page.

    Connect to an Azure VM from the portal

  2. On the Connect to virtual machine page, keep the default options to connect by IP address over port 3389. Select Download RDP file.

    Download the RDP file

  3. Open the downloaded RDP file and select Connect when prompted.

  4. In the Windows Security window, select More choices and then Use a different account. Type the username as localhost\username, enter the password you created for the virtual machine, and then select OK.

    More choices

  5. You might receive a certificate warning during the sign-in process. Select Yes or Continue to create the connection.

Prepare the Windows server

For the Windows Server 2016 Datacenter server, disable Internet Explorer Enhanced Security Configuration. This step is required only for initial server registration. You can re-enable it after the server has been registered.

In the Windows Server 2016 Datacenter VM, Server Manager opens automatically. If Server Manager doesn't open by default, search for it in File Explorer.

  1. In Server Manager, select Local Server.

    "Local Server" on the left side of the Server Manager UI

  2. On the Properties pane, select the link for IE Enhanced Security Configuration.

    The "IE Enhanced Security Configuration" pane in the Server Manager UI

  3. In the Internet Explorer Enhanced Security Configuration dialog box, select Off for Administrators and Users.

    The Internet Explorer Enhanced Security Configuration pop-window with "Off" selected

Now you can add the data disk to the VM.

Add the data disk

  1. While still in the Windows Server 2016 Datacenter VM, select Files and storage services > Volumes > Disks.

    Data disk

  2. Right-click the 1 GB disk named Msft Virtual Disk and select New volume.

  3. Complete the wizard. Use the default settings and make note of the assigned drive letter.

  4. Select Create.

  5. Select Close.

    At this point, you've brought the disk online and created a volume. Open File Explorer in the Windows Server VM to confirm the presence of the recently added data disk.

  6. In File Explorer in the VM, expand This PC and open the new drive. It's the F: drive in this example.

  7. Right-click and select New > Folder. Name the folder FilesToSync.

  8. Open the FilesToSync folder.

  9. Right-click and select New > Text Document. Name the text file MyTestFile.

    Add a new text file

  10. Close File Explorer and Server Manager.

Download the Azure PowerShell module

Next, in the Windows Server 2016 Datacenter VM, install the Azure PowerShell module on the server.

  1. In the VM, open an elevated PowerShell window.

  2. Run the following command:

    Install-Module -Name Az
    

    Note

    If you have a NuGet version that is older than 2.8.5.201, you're prompted to download and install the latest version of NuGet.

    By default, the PowerShell gallery isn't configured as a trusted repository for PowerShellGet. The first time you use the PSGallery, you see the following prompt:

    Untrusted repository
    
    You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet.
    
    Are you sure you want to install the modules from 'PSGallery'?
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"):
    
  3. Answer Yes or Yes to All to continue with the installation.

The Az module is a rollup module for the Azure PowerShell cmdlets. Installing it downloads all the available Azure Resource Manager modules and makes their cmdlets available for use.

At this point, you've set up your environment for the tutorial. You're ready to deploy the Storage Sync Service.

Deploy the service

To deploy Azure File Sync, you first place a Storage Sync Service resource into a resource group for your selected subscription. The Storage Sync Service inherits access permissions from its subscription and resource group.

  1. In the Azure portal, select Create a resource and then search for Azure File Sync.

  2. In the search results, select Azure File Sync.

  3. Select Create to open the Deploy Storage Sync tab.

    Deploy Storage Sync

    On the pane that opens, enter the following information:

    Value Description
    Name A unique name (per subscription) for the Storage Sync Service.

    Use afssyncservice02 for this tutorial.
    Subscription The Azure subscription you use for this tutorial.
    Resource group The resource group that contains the Storage Sync Service.

    Use afsresgroup101918 for this tutorial.
    Location East US
  4. When you're finished, select Create to deploy the Storage Sync Service.

  5. Select the Notifications tab > Go to resource.

Install the agent

The Azure File Sync agent is a downloadable package that enables Windows Server to be synced with an Azure file share.

  1. In the Windows Server 2016 Datacenter VM, open Internet Explorer.

  2. Go to the Microsoft Download Center. Scroll down to the Azure File Sync Agent section and select Download.

    Sync agent download

  3. Select the check box for StorageSyncAgent_V3_WS2016.EXE and select Next.

    Select agent

  4. Select Allow once > Run > Open.

  5. If you haven't already done so, close the PowerShell window.

  6. Accept the defaults in the Storage Sync Agent Setup Wizard.

  7. Select Install.

  8. Select Finish.

You've deployed the Azure Sync Service and installed the agent on the Windows Server 2016 Datacenter VM. Now you need to register the VM with the Storage Sync Service.

Register Windows Server

Registering your Windows server with a Storage Sync Service establishes a trust relationship between your server (or cluster) and the Storage Sync Service. A server can only be registered to one Storage Sync Service. It can sync with other servers and Azure file shares that are associated with that Storage Sync Service.

The Server Registration UI should open automatically after you install the Azure File Sync agent. If it doesn't, you can open it manually from its file location: C:\Program Files\Azure\StorageSyncAgent\ServerRegistration.exe.

  1. When the Server Registration UI opens in the VM, select OK.

  2. Select Sign-in to begin.

  3. Sign in with your Azure account credentials and select Sign-in.

  4. Provide the following information:

    A screenshot of the Server Registration UI

    Value Description
    Azure Subscription The subscription that contains the Storage Sync Service for this tutorial.
    Resource Group The resource group that contains the Storage Sync Service. Use afsresgroup101918 for this tutorial.
    Storage Sync Service The name of the Storage Sync Service. Use afssyncservice02 for this tutorial.
  5. Select Register to complete the server registration.

  6. As part of the registration process, you're prompted for an additional sign-in. Sign in and select Next.

  7. Select OK.

Create a sync group

A sync group defines the sync topology for a set of files. A sync group must contain one cloud endpoint, which represents an Azure file share. A sync group also must contain one or more server endpoints. A server endpoint represents a path on a registered server. To create a sync group:

  1. In the Azure portal, select + Sync group from the Storage Sync Service. Use afssyncservice02 for this tutorial.

    Create a new sync group in the Azure portal

  2. Enter the following information to create a sync group with a cloud endpoint:

    Value Description
    Sync group name This name must be unique within the Storage Sync Service, but can be any name that is logical for you. Use afssyncgroup for this tutorial.
    Subscription The subscription where you deployed the Storage Sync Service for this tutorial.
    Storage account Choose Select storage account. On the pane that appears, select the storage account that has the Azure file share you created. Use afsstoracct101918 for this tutorial.
    Azure file share The name of the Azure file share you created. Use afsfileshare for this tutorial.
  3. Select Create.

If you select your sync group, you can see that you now have one cloud endpoint.

Add a server endpoint

A server endpoint represents a specific location on a registered server. For example, a folder on a server volume. To add a server endpoint:

  1. Select the newly created sync group and then select Add server endpoint.

    Add a new server endpoint in the sync group pane

  2. On the Add server endpoint pane, enter the following information to create a server endpoint:

    Value Description
    Registered server The name of the server you created. Use afsvm101918 for this tutorial.
    Path The Windows Server path to the drive you created. Use f:\filestosync in this tutorial.
    Cloud Tiering Leave disabled for this tutorial.
    Volume Free Space Leave blank for this tutorial.
  3. Select Create.

Your files are now in sync across your Azure file share and Windows Server.

Azure Storage successfully synced

Clean up resources

When you're done, you can delete the resource group. Deleting the resource group deletes the storage account, the Azure file share, and any other resources that you deployed inside the resource group.

  1. In the left menu, select Resource groups.
  2. Right-click the resource group, and then select Delete resource group. A window opens and displays a warning about the resources that will be deleted with the resource group.
  3. Enter the name of the resource group, and then select Delete.

Next steps

In this tutorial, you learned the basic steps to extend the storage capacity of a Windows server by using Azure File Sync. For a more thorough look at planning for an Azure File Sync deployment, see: