DFS in Azure

Often we want to use Azure's scalable storage to deploy file servers. For geographically distributed infrastructures, it makes sense to establish a distributed file system (DFS) that spans across regions, both for availability and reach. 

Here is a summary of the steps required to do so:

  1. Create a vnet in each desired datacenter, ideally with at least 2 subnets (1 for the domain controllers, another for the file servers) + 1 for the gateway
  2. Establish cross-premise connectivity in Azure, for instance as explained in https://msdn.microsoft.com/en-us/library/azure/dn690122.asp
  3. Deploy domain controllers on the relevant subnets in both datacenters. Make sure that the dns option in the vnet configurations points to both domain controllers in the appropriate order (dc1, dc2 on vnet1 - dc2, dc1 on vnet2).
    1. It is recommended that you assigned a fixed ip to the domain controllers / dns servers. You will need Powershell to do that as explained in https://msdn.microsoft.com/en-us/library/azure/dn630228.aspx.
  4. Deploy servers on the relevant subnets and join them to the domain.
  5. Add at least a data volume each to the servers to host the file shares. If you are planning to replicate its content using dfs-r, it may make sense to put the volume on a locally redundant storage account.
  6. Log into each server and, in “configure local server”, add the DFS namespace and DFS replication features.
    1. Alternatively, you could use Powershell desired configuration to deploy servers with those features enabled. See https://blogs.msdn.com/b/powershell/archive/2014/08/07/introducing-the-azure-powershell-dsc-desired-state-configuration-extension.aspx 
  7. In the dfs management console on server 1, create a namespace.
    1. Select “edit settings” and assign full access to administrator, r/w to other users
    2. Make sure that it is a domain-based namespace and “2008 mode” is enabled. Information about namespace roots is then replicated on namespace servers in the domain.
  8. Add server 2 as a namespace server to the namespace you've just created for availability.
  9. Select “new folder” in the namespace.
  10. Create a new file share hosted on the local data volume (e.g.\\server1\share1). Assign permissions as desired (e.g. admins full access and rest r/w).
  11. Click on the share you've just created and select “replicate folder”.
  12. Add a target for the replication on server2 e.g. \\server2\share1
  13. Create replication group as required, by following prompts.
  14. You may also want to verify that replication works both ways by creating a share on server2 that is replicated to a target on server1.