4 min. Read

In July 2018, Microsoft announced GA release for Azure File Sync. With Azure File Sync, you can centralize your files in Azure and then install a sync agent on Windows Server, whether it’s local or Azure, to provide fast local access to your files. Your servers and Azure files are constantly in sync, so you have one centralized location for your files with access to multiple sites, which works with a fast local cache and cloud ladder.

If for some reason your server is unavailable, you just need to install it Sync Azure files agent on another server or virtual machine, and users and applications can reuse the file in minutes, this is a great solution for a fast file server DR scenario. Through integration Azure backup service, you can also protect your data in the cloud despite local backup solutions. With Sync Azure files, you get the benefits of merging files into a cloud service with the performance of your local file server.

For more information on Azure File Sync, check the previous one a step-by-step guide to getting started with Azure File Sync and PowerShell. In addition, Microsoft simplified the implementation of Azure File Sync in the Windows Control Center to make the process easier. See the following article for more information Windows Control Center and Azure File Sync.

With the first release of Azure File Sync, Microsoft supported the following versions of Windows Server and installation options:

  • Windows Server 2019 (Datacenter and Standard) – A server with desktop experience
  • Windows Server 2016 (Datacenter and Standard) – A server with a desktop experience
  • Windows Server 2012 R2 (Datacenter and Standard) – A server with a desktop experience

Microsoft has pushed IT professionals into Server Core hard, because Server Core has a smaller footprint with a smaller footprint, making it less vulnerable than the Server with Desktop Experience option, but it still supports Azure file sharing and Azure file synchronization to help us use Azure clouds without Server Core support. The Community did not appreciate this lack of support.

Microsoft confirmed that Server Core support is also coming to Azure File Sync. The reason why the delay is due to you having to log in to the AzureRM / AZ module with a username / password is not working properly because Server Core is unable to open IE login. The user’s voice was very active in previous months add support for Azure File Sync Server Core installations.

Finally, the wait is over, by releasing Azure File Sync Agent version 6, Microsoft added support for Server Core installations!

In this article, I will show you how to install Azure File Sync on a Windows Server Core installation.

The conditions are very simple as follows:

  1. You must have Windows Server Core (Datacenter or Standard), either Windows Server 2012 R2, 2016, or 2019.
  2. You need to download and install PowerShell version 6 here. At the time of this writing, Microsoft released PowerShell v6.2.0.
  3. You must install the latest The PowerShell module is here.
  4. You also need to install the latest one Az.StorageSync module here.
  5. You need to download and install Azure File Sync Agent v6.0 here.

This section describes how to automate the Azure File Sync installation in Server Core.

First you need to download and install PowerShell version 6, you can run the following scripts:

#! Download PowerShell v6.2
Invoke-WebRequest `
      -Uri https://github.com/PowerShell/PowerShell/releases/download/v6.2.0/PowerShell-6.2.0-win-x64.msi `
      -OutFile "PowerShell6.msi" 
      
#! Install PowerShell v6.2 in Silent mode
Start-Process -FilePath ".PowerShell6.msi" -ArgumentList "/quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1" -Wait

#! Switch to PowerShell 6
Set-Location -Path "C:Program FilesPowerShell6"
.pwsh.exe

Next you need to install module as well The StoreSync module.

#Install PowerShell Az Module
Try {
    Import-Module -Name Az -ErrorAction Stop -Verbose:$false | Out-Null
    }
Catch {
    Install-Module -Name Az -Force -Confirm:$false
}

#Install PowerShell Az.StorageSync Module
Try {
    Import-Module -Name Az.StorageSync -ErrorAction Stop -Verbose:$false | Out-Null
    }
Catch {
    Install-Module -Name Az.StorageSync -Force -Confirm:$false
}

The next step is to download and install Azure File Sync Agent v6. Run the following command in Windows Server Core. This will download the appropriate Azure File Sync agent based on your operating system version.

# Gather the OS version
$osver = [System.Environment]::OSVersion.Version

# Download the appropriate version of the Azure File Sync agent for your OS.
# Azure File Sync Version 6.0
# Windows Server 2019
if ($osver.Equals([System.Version]::new(10, 0, 17763, 0))) {
    Invoke-WebRequest `
        -Uri https://download.microsoft.com/download/1/8/D/18DC8184-E7E2-45EF-823F-F8A36B9FF240/StorageSyncAgent_V6_WS2019.msi `
        -OutFile "StorageSyncAgent.msi" 
}
# Windows Server 2016
elseif ($osver.Equals([System.Version]::new(10, 0, 14393, 0))) {
    Invoke-WebRequest `
        -Uri https://download.microsoft.com/download/1/8/D/18DC8184-E7E2-45EF-823F-F8A36B9FF240/StorageSyncAgent_V6_WS2016.msi `
        -OutFile "StorageSyncAgent.msi" 
}
# Windows Server 2012 R2
elseif ($osver.Equals([System.Version]::new(6, 3, 9600, 0))) {
    Invoke-WebRequest `
        -Uri https://download.microsoft.com/download/1/8/D/18DC8184-E7E2-45EF-823F-F8A36B9FF240/StorageSyncAgent_V6_WS2012R2.msi `
        -OutFile "StorageSyncAgent.msi" 
}
else {
    throw [System.PlatformNotSupportedException]::new("Azure File Sync is only supported on Windows Server 2012 R2, Windows Server 2016, and Windows Server 2019")
}

# Install the MSI package in silent mode
Start-Process -FilePath ".StorageSyncAgent.msi" -ArgumentList "/quiet" -Wait

Next, you need to connect and authenticate using Azure Connect to AzAccount cmdlet. When you run this cmdlet, it contains a string. Log in by copying and pasting the code https://microsoft.com/devicelogin browser on a different machine. Your PowerShell session is authenticated to connect to Azure.

Finally, you need to register your file server with Azure Storage Sync by running the following command. You must specify the resource group name and the Storage Sync service name.

Register-AzStorageSyncServer -ResourceGroupName 'String' -StorageSyncServiceName 'String'

Here is a short video that shows you how to enable Azure File Sync in Windows Server Core in action.

And that’s where you have it.

Azure File Sync extends local file servers to Azure while providing cloud benefits while maintaining performance and compatibility.

Azure File Sync offers:

  • Multi-site access – grant write access to the same data through Windows servers and Azure Files.
  • Cloud Stairs – Store only recently used data on local servers.
  • Integrated with Azure backup – you don’t have to back up your data on site.
  • Quick Emergency Recovery – recover file metadata immediately and retrieve the data as needed.

Windows Server Core support and Windows Control Center, there is no excuse for not using Azure File Sync.

I hope you find this article useful.

__
Thanks for locking my blog.

If you have any questions or feedback, please leave a comment.

-Charbel Nemnom-

LEAVE A REPLY

Please enter your comment!
Please enter your name here