Search code examples
azureazure-storageazure-rm-templateazure-filesazure-storage-files

How to register a server for an Azure file sync using ARM TEMPLATE


The below lines of code is an arm template section that I tried and didn't work for me.

 {
        "type": "microsoft.storagesync/storageSyncServices/registeredServers",
        "apiVersion": "2020-03-01",
        "name": "[concat(parameters('storagesyncname'), 'xxx')]",
        "dependsOn": [
            "[resourceId('microsoft.storagesync/storageSyncServices', parameters('storagesyncname'))]"
        ],
        "properties": {
            "agentVersion": "11.1.0.0",
            "serverOSVersion": "10.0.17763.0",
            "lastHeartBeat": "2021-02-09T12:36:34.36877Z",
            "serverRole": "Standalone",
            "clusterId": "00000000-0000-0000-0000-000000000000",
            "serverId": "xxxx",
            "friendlyName": "xxx"
        }
    }

Solution

  • AFAIK, using an ARM template to register a server isn't a supported approach. As mentioned in the docs, you can register a server as follows:

    • Download the Azure File Sync agent and install it on all servers you want to sync.
    • After finishing the agent install, you can either:
      • use the server registration utility that opens to register the server to a Storage Sync Service, or

      • use the Register-AzStorageSyncServer cmdlet from the Az.StorageSync module to register the server with a Storage Sync service. Note that this command has to be run on the server you want to register.

        Register-AzStorageSyncServer -ResourceGroupName "myResourceGroup" -StorageSyncServiceName "myStorageSyncServiceName"
        

    You will then get the ServerId in the output.

    At this point, if you browse to your Storage Sync Service in the Azure portal, you should be able to see your server listed in the Registered servers blade. PowerShell or the Azure portal can then be used to configure sync on this server.