In this article, we are going to discuss Implementing Azure File Sync in Azure Portal. Transform Windows Server into a quick cache of Azure File Share using Azure File Sync. Implement file sync, that enables you to share the files with Azure Storage account and Virtual Machine. Now you can centralize an organization’s file in Azure Files using Azure File Sync.
You must need a valid Azure Subscription and need some knowledge on Azure File Sync and Template deployment to work in this session. Follow the below steps for implementing Azure File Sync.
Deploying an Azure Virtual Machine using Azure Resource Manager Template
- Log in with your Azure account using http://portal.azure.com
- Click on create new resource panel and search for Template Deployment.
- Select Build your own template in the editor.
- In the edit template panel load the template file az-100-02b_azuredeploy.json and save the template.
- Then navigate to the Custom deployment panel and click on Edit Parameter.
- Load the file az-100-02b_azuredeploy.parameters.json by clicking load file and save the parameter.
- In Custom deployment panel, start a template deployment with the following settings and click on the purchase
- Subscription: select a valid subscription
- Resource group: the name of a new resource group DemoRG1
- Location: Select the valid one
- Vm Size: Standard_DS1_v2
- Vm Name: DemoVM1
- Admin Username: DemoUser
- Admin Password: For your choice
- Virtual Network Name: demoVnet1
Preparing Azure File Sync Infrastructure
Step1-Creating an Azure Storage account and a file share
- In Azure Portal click on Create a new resource and search for Storage account.
- In the Create storage account panel, create a new storage account with following settings
- Subscription: select a valid one
- Resource group: Create a new resource group StorageRG1
- Storage account name: DemoStorage1
- Location: Select a valid one
- Performance: Standard
- Account kind: Storage (general purpose v1)
- Replication: Locally-redundant storage (LRS)
- Secure transfer required: Disabled
- Allow access from: All networks
- Hierarchical namespace: Disabled
- Navigate to the created storage account DemoStorage1 and click on File.
- From the Files panel, create a new file share
- Name: FileShare1
- Quota: none
Step2-Preparing Windows Server 2016 for use with Azure File Sync
- Connect to the Virtual Machine DemoVM1 that you have created using valid credentials
- Admin Username: DemoUser
- Admin Password: which you have provided while creating the VM
- After connecting to the Virtual Machine navigate to Server Manager, click on File and Storage Services, find the data disk attached to the Azure VM and initialize it as a GPT.
- Click on New Volume Wizard to create a single volume occupying entire disk with the following settings
- Drive letter: S
- File system: NTFS
- Allocation unit size: Default
- Volume label: Data
- Start Windows PowerShell session as Administrator and run the following commands in order.
$directory = New-Item -Type Directory -Path ‘S:\FileShare1’
New-SmbShare -Name $directory.Name -Path $directory.FullName -FullAccess ‘Administrators’ -ReadAccess Everyone
Copy-Item -Path ‘C:\WindowsAzure\*’ -Destination $directory.FullName –Recurse
- Install AzureRM using the command
Install-Module -Name AzureRM
Step3- Running Azure File Sync evaluation tool
- In PowerShell install the Package Management and PowerShellGet by running the command.
Install-Module -Name PackageManagement -Repository PSGallery -Force
Install-Module -Name PowerShellGet -Repository PSGallery -Force
- Restart the PowerShell session and run the following command to install Azure File Sync.
Install-Module -Name Az.StorageSync -AllowPrerelease -AllowClobber -Force
- Install the Azure File Sync PowerShell module by running the command.
Invoke-AzStorageSyncCompatibilityCheck -Path ‘S:\FileShare1’
- verify that no compatibility issues have been found.
Prepare Azure File Sync infrastructure
Step1- Deploying the Storage Sync Service
- In Server Manager, navigate to the Local Server and turn off the IE Enhanced Security Configuration.
- Open the browser and login with your Azure account using http://portal.azure.com.
- Click on create a new resource and search for Azure File Sync.
- Create a Storage Sync Service with the following settings and click on create.
- Name: DemoStorageSync
- Subscription: Select a valid subscription
- Resource group: Create a new resource group StorageSyncRG
- Location: Select a valid location
Step3- Installing Azure File Sync Agent
- Download the Azure File Sync Agent Windows Installer file using the link https://go.microsoft.com/fwlink/?linkid=858257 select the file StorageSyncAgent_V5_WS2016.msi and run it.
Step3- Registering Windows server with the storage sync service
- In the Azure File Sync – Server Registration page, sign in by using the same Microsoft account that you used in this lab.
- On the Azure File Sync – Server Registration register with your storage account
- Azure Subscription: the one which you are using in this lab
- Resource group: StorageSyncRG
- Storage Sync Service: DemoStorageSync
Step4 – Creating a Sync group and a cloud endpoint
- Navigate to the DemoStorageSync Storage Sync panel and view the Sync group panel to create a new sync group with the following settings
- Sync group name: demosyncgroup1
- Azure Subscription: select a valid one
- Storage account: DemoStorage1
- Azure File Share: FileShare1
Creating Server End-Point
- In the Azure portal, from the DemoStorageSync Storage Sync panel, navigate to the demosyncgroup1 and click on Add server endpoint panel and create a new server endpoint with the following settings
- Registered server: DemoVM1
- Path: S:\DemoShare1
- Cloud Tiering: Enabled
- Volume: 15
- Specified number of days: 30
- Offline Data Transfer: Disabled
Task6- Validate Azure File Sync Operation
- In the Azure portal, monitor the health status of the server endpoint DemoVM1 on the demosyncgroup1 panel, as it changes from red mark to green mark.
- Start File Explorer and go to the Z: drive, verify that the drive contains the same content as S:\DemoShare1
- Check that the file is synced with the file you created in the storage account.