Azure File Sync
Microsoft Azure File Sync is a great way to send your on-premises Server files to the cloud. The only shortcoming is that file changes made directly from the Azure Storage Account can take up to 24 hours to replicate back to the on-premises Server.
In this article I will show a way to replicate more frequently and even on demand.
Please note that at this point in time,
is limited to datasets less then 10K objects! In other words, this article won’t work for directories with more then ten thousand objects.
- Login to your Azure Portal.
- Create a new resource in Azure, All Services > ‘automation’ > Automation Accounts
- ‘Add’ a new Account, give it a name and choose options suited to your environment
- Go into your the newly created AutomationAccount, under Shared Resources click Modules > Browse gallery
- Search for Az.Accounts, then Click Import
- Search for Az.StorageSync , again Import. Please wait for the modules to import, once done they will appear as Available.
- Under Process Automation, click Runbooks > Create a runbook
- Give it a name, the Runbook type is Powershell
- Go into the Runbook and Edit it
- Paste the following into CMDLETS Sync This script comes from Charbel Nemnom, you can check out his other work at https://charbelnemnom.com
- Save, then Publish the Runbook
- Click Schedules > Add schedule
- Give the Schedule a name and set Recurring options
- Configure the Parameters, pay attention to the Path* . The Path refers to the directory in which you wish to force sync.
i.e. if your Azure FileSync is syncing everything in c:\Shares and you wish to force sync c:\Shares\Clients you would enter the PATH as Clients
So now that its all done, you can test it by uploading a file directly AzureStorage, run the Playbook manually or wait for the next sync. The file you uploaded directly to Azure will now appear on the on-premises server.