Blog Post

Core Infrastructure and Security Blog
5 MIN READ

Azure File Sync Switching Server Endpoint on Existing Server

AndrewCoughlin's avatar
Jul 26, 2021

Hello everyone, Andrew Coughlin here, a Cloud Solution Architect specializing in Infrastructure as a Service on Azure. This post was first published on September 25, 2020, and since then, there have been new recommendations on how to replace an existing Azure File Sync server.

 

Suppose you are dealing with an aging OS and planning to upgrade the current server to Windows Server 2022. This server functions as a file server running Azure File Sync. You might be wondering about the best way to transition to a new Windows Server. Alternatively, you may want to reduce the drive size on an existing server and are curious about the recommended method for resizing a drive managed by Azure File Sync. This article will guide you through these steps, but please note that the outlined process requires downtime. If you need a method that doesn't involve downtime, please refer to this article on the steps to achieve that.

The process we are going to follow in this article is as follows:

  1. Stop user access to server path.
  2. Wait for final upload session to complete.
  3. Take VSS snapshot. (Optional)
  4. Delete the server endpoint.
  5. Create the new server endpoint on the new drive using the same drive letter as the old drive.
  6. Enable access to new path.

 

Prerequisites

  • Existing Azure File Sync Service setup and configured.
  • Deploy a new Windows Server with the Azure File Sync agent installed.
    • Download the Azure File Sync Agent here.
    • Make sure to have a data drive attached to it.
  • Prepare your Windows Server to use Azure File Sync as documented here.
    • Complete the from “Preparing Windows Server to use with Azure File Sync” to “Register Windows Server with Storage Sync Service”, make sure to complete all steps in this section.

 

Stop user access to server path

We want to make sure that no end users can access this share while we perform this activity.  Depending on your scenario you could achieve this in a couple of different ways.  In this example I will unshare the folder to ensure no one can access the files on this file server since I only have one volume with a single share shared out to my end users.

  1. On the file server navigate to the share and right click > click properties.

 

  1. Click Security > Advanced Sharing > Permissions.

 

  1. Remove users from the Share.

NOTE: Take note of how this is configured before had as you will need to set this back once finished.

  1. Click Remove > Ok,

 

Wait for final upload session to complete

  1. On the file server open powershell.
  2. You will want to import the modules to manage Azure File Sync, make sure to change the SyncAgentInstallPath based on your installation.

Import-Module <SyncAgentInstallPath>\StorageSync.Management.PowerShell.Cmdlets.dll'

Import-Module '<SyncAgentInstallPath>\StorageSync.Management.ServerCmdlets.dll'

 

 

 

 

 

  1. Type Debug-StorageSyncServer -FileSyncErrorReport and press Enter.
  2. Validate there are no errors and the SyncSessionResultCode for Upload is 0.

 

  1. Go to the Azure Portal.
  2. Click Storage Sync Service > Select your Azure Sync Service > Click Sync Groups > Click the sync group that matches the volume you just removed access to from end users.

 

  1. Click on the Server endpoint name.
  2. Validate Upload to cloud was last successful.

 

  1. Switch back to the file server. 
  2. Launch Eventvewer.
  3. Navigate to Applications and Services > Microsoft > FileSync > Agent > Telemtry.
  4. Click Filter Current Log.

 

 

  1. In the Includes/Excludes Event ID, type 9302 and click OK.

 

 

  1. Review the last Event, to ensure everything was uploaded and there were no errors.

 

 

Take VSS snapshot. (Optional)

To take a VSS snapshot you can use the native vssadmin to do this which is documented: Vssadmin create shadow | Microsoft Learn.  Another option would be to use Azure Backup if the virtual machine is in Azure: Quickstart - Back up a VM with the Azure portal by using Azure Backup - Azure Backup | Microsoft Learn.

Delete the server endpoint

  1. Go back to the Azure Portal.
  2. Go to the Sync Group overview page.
  3. Click the three dots on the right hand side for the Server Endpoint.
  4. Click Delete.

 

 

  1. Select I want to delete my server endpoint and stop using this Azure file share.
  2. Scroll down.

 

 

  1. Check the check box “I’m ready to delete the server endpoint” > Click Delete.

 

 

Create the new server endpoint

  1. From the Sync Group overview page.
  2. Click Add server endpoint.
  3.  

  4. Select the Registered Server, Provide the path, select cloud tiering settings (Free space policy and date Policy)

 

NOTE: This step is important, you must have the path the same as the last server, including the drive letter!

 

 

  1. Click Create.

 

 

  1. Once finished the sync group will look like the following:

 

 

  1. When you click on the Server Name + path the server endpoint setting should look like the following:

 

 

Enable access to new path

  1. On the file server navigate to the share and right click > click properties.

 

  1. Click Security > Advanced Sharing > Permissions.

 

  1. Click Add.

 

 

  1. Add the objects names that you removed in Step 4, Stop user access to server path.

 

  1. Set the permissions as required and click OK.

 

  1. Click OK > Click Ok.

 

  1. Navigate to the share location and confirm files are now present on the server.

 

Conclusion

In this blog I have covered how to transition Azure File Sync from one server to another. Are you a Unified customer? If so and you are wanting to know more about Azure File Sync and Azure Files, ask your CSAM about the Activate Azure with Azure File offering.  Thank you for taking the time to read this blog, I hope this helps you and see you next time.

 

Disclaimer

The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without a warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.

Updated Oct 30, 2024
Version 3.0
No CommentsBe the first to comment