Wednesday, March 29, 2017

How to use Azure File Storage as a backup disk on Windows Server

Azure File Storage (AFS) is a file storage service hosting on Azure cloud, it can be used for backup data, files or accessing files like S3 of Amazon.

In this article, I'll show you how to create a storage, map it as a local disk on Windows Server and backup files in a schedule.

1. Create a storage

Login to your Azure portal >> click Storage accounts menu >> click plus +Add button


Below is an example for a standard storage with lowest cost. You can see Azure Storage Pricing for more details.

Once done, open the storage and copy Access keys (can copy key 1 only):

2. Map the storage as local disk

Open cmd tool and run the command like below to map the storage s a local disk on Windows Server:
net use X: \\xxxStorageName.file.core.windows.net\xxxFileFolder /u:xxxStorageName xxxKey

In which:
X: is the letter of the local disk mapped
xxxStorageName: name of the storage you keyed in step 1 (see Create storage account picture)
xxxKey: access key

3. Create a .bat file and put into a Task Scheduler

For example, I want to copy logs file from a folder on another disk to this storage disk. So I create a .bat file naming copylogs.bat with content as below:
@echo off
copy D:\daily\*.log X:\daily
del D:\daily\*.log

After that, I create a Task Scheduler to run this .bat file on 1 AM daily:

It's simple. Hope you can save your data or files on the cloud. It's worth when your server is damaged or something like that.

Any comment is welcome!
Subscribe to RSS Feed Follow me on Twitter!