この記事は更新から24ヶ月以上経過しているため、最新の情報を別途確認することを推奨いたします。
Azure FilesとAzure File Sync
Azure Files(Azureファイル共有)はフルマネージドのファイル共有サービスです。
このブログでも何度か紹介をしています。
ファイルサーバー on Azure(2019年最新版)
Azure Filesは以下の二つの方法で利用することができます。
1. サーバーレスのAzureファイル共有を直接マウント
2. Azure File Syncを使用してAzureファイル共有をWindowsサーバに同期
今回は2.のAzure File Syncを利用した同期構成を用意し、Azure FilesとAzure File Syncがどのように動作するのかを確認します。
作成する同期構成
同期構成をとるにあたって以下の概念を理解しておく必要があります。
クラウドエンドポイント:同期対象となるAzureファイル共有
サーバエンドポイント:Azureファイル共有に同期するWindows Server上のパス
同期グループ:同期するクラウドエンドポイントとサーバエンドポイントの紐づけ
図のように1つのクラウドエンドポイントと2つのサーバエンドポイントを用意し、ファイルの同期が行われるかを確認してみました。
同期グループの作成
まずAzureファイル共有を作成します。

続いて、AzureFileSyncを作成します。


ストレージ同期サービスに移動します。
サーバエンドポイントとなるWindowsサーバを用意し、「同期サーバ」として登録しますが、そのためには同期サーバにエージェントをインストールする必要があります。
エージェントをインストールすると認証を求められますので、先ほどAzuleファイル共有を作成したアカウントでサインインします。
Azure File Syncのリソースを選択します。

登録済みサーバに現れれば成功です。

続いて同期グループを作成します。
「Azureファイル共有」では作成したAzureファイル共有を選択します。
これがクラウドエンドポイントになります。

続いてサーバエンドポイントを追加します。
サーバエンドポイントは登録済みの「同期サーバ」より選択します。


ファイルを同期してみる
クライアントAにてサーバエンドポイント(同期サーバA)にアクセスし、ファイルを作成します。

Azureファイル共有に同期されました。

クライアントBにてサーバエンドポイント(同期サーバB)にアクセスすると、先ほどのファイルが同期されているのがわかります。

今度は逆に、クライアントBにてサーバエンドポイント(同期サーバB)にアクセスし、ファイルを作成します。

Azureファイル共有に同期されました。

クライアントAでも同期が確認できました。
