我们如何通过 ARM 模板将服务器 ID 传递到服务器端点到存储同步又名文件同步服务
How do we pass the server ID to a server endpoint to a Storage sync aka file sync service through an ARM template
*"type": "microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints"
{
"type": "microsoft.storagesync/storageSyncServices/registeredServers",
"apiVersion": "2020-03-01",
"name": "[concat(parameters('FilesyncName'), '/rs')]",
"dependsOn": [
"[resourceId('microsoft.storagesync/storageSyncServices', parameters('FilesyncName'))]"
],
"properties": {
"agentVersion": "XXXX",
"serverOSVersion": "XXXX",
"lastHeartBeat": "XXXXX",
"serverRole": "Standalone",
"clusterId": "XX",
"serverId": "XXXXX",
"friendlyName": "XXXXXXXX"
}
},
{
"type": "microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints",
"apiVersion": "2020-03-01",
"name": "[concat(parameters('FilesyncName'),'/',parameters('syncgroupname'),'/','-se')]",
"dependsOn": [
"[resourceId('microsoft.storagesync/storageSyncServices/syncGroups', parameters('FilesyncName'), parameters('syncgroupname'))]",
"[resourceId('microsoft.storagesync/storageSyncServices', parameters('FilesyncName'))]",
"[resourceId('microsoft.storagesync/storageSyncServices/registeredServers', parameters('FilesyncName'), 'rs')]"
],
"properties": {
"serverLocalPath": "F:\",
"cloudTiering": "On",
"volumeFreeSpacePercent": 20,
"tierFilesOlderThanDays": 7,
"friendlyName": "XXXX",
"serverResourceId": "[resourceId('microsoft.storagesync/storageSyncServices/registeredServers', parameters('FilesyncName'), 'rs')]",
"offlineDataTransfer": "On",
"offlineDataTransferShareName": "fsnew",
"initialDownloadPolicy": "NamespaceOnly",
"localCacheMode": "UpdateLocallyCachedFiles"
}
}*
上述资源类型和用于添加服务器端点的ARM TEMPLATE。
此模板不会触发配置服务器端点。想看看 same.TIA
的例子
我看不出有什么理由不这样做。它只是 Azure ARM api.
中的常规提供程序
以下是部署存储同步服务、同步组和服务器端点的工作 ARM 模板。
当您按照 所述向您的存储同步服务器注册服务器时,您可以获得 serverResourceId
属性,但 ResourceId 格式为:
/subscriptions/***/resourceGroups/***/providers/microsoft.storagesync/storageSyncServices/mystoragesyncservice/registeredServers/85fa92da-2b2e-447c-d3rg-f8bf43c4064f
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storagesyncservicename": {
"type": "string",
"defaultValue": "mystoragesyncservice"
}
},
"variables": {},
"resources": [
{
"type": "microsoft.storagesync/storageSyncServices",
"apiVersion": "2020-03-01",
"name": "[parameters('storagesyncservicename')]",
"location": "westus2",
"properties": {
"incomingTrafficPolicy": "AllowAllTraffic"
}
},
{
"type": "microsoft.storagesync/storageSyncServices/syncGroups",
"apiVersion": "2020-03-01",
"name": "[concat(parameters('storagesyncservicename'), '/mystoragesyncgroup')]",
"dependsOn": [
"[resourceId('microsoft.storagesync/storageSyncServices', parameters('storagesyncservicename'))]"
],
"properties": {}
},
{
"type": "microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints",
"apiVersion": "2020-03-01",
"name": "[concat(parameters('storagesyncservicename'), '/mystoragesyncgroup/5770750b-a1e6-4910-9781-1482fdee757a')]",
"dependsOn": [
"[resourceId('microsoft.storagesync/storageSyncServices/syncGroups', parameters('storagesyncservicename'), 'mystoragesyncgroup')]",
"[resourceId('microsoft.storagesync/storageSyncServices', parameters('storagesyncservicename'))]"
],
"properties": {
"serverLocalPath": "D:\Data",
"cloudTiering": "Off",
"volumeFreeSpacePercent": 20,
"friendlyName": "mytestafs",
"serverResourceId": "/subscriptions/***/resourceGroups/***/providers/microsoft.storagesync/storageSyncServices/mystoragesyncservice/registeredServers/85fa92da-2b2e-447c-d3rg-f8bf43c4064f",
"offlineDataTransfer": "Off",
"initialDownloadPolicy": "NamespaceThenModifiedFiles",
"localCacheMode": "UpdateLocallyCachedFiles"
}
}
]
}
*"type": "microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints"
{
"type": "microsoft.storagesync/storageSyncServices/registeredServers",
"apiVersion": "2020-03-01",
"name": "[concat(parameters('FilesyncName'), '/rs')]",
"dependsOn": [
"[resourceId('microsoft.storagesync/storageSyncServices', parameters('FilesyncName'))]"
],
"properties": {
"agentVersion": "XXXX",
"serverOSVersion": "XXXX",
"lastHeartBeat": "XXXXX",
"serverRole": "Standalone",
"clusterId": "XX",
"serverId": "XXXXX",
"friendlyName": "XXXXXXXX"
}
},
{
"type": "microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints",
"apiVersion": "2020-03-01",
"name": "[concat(parameters('FilesyncName'),'/',parameters('syncgroupname'),'/','-se')]",
"dependsOn": [
"[resourceId('microsoft.storagesync/storageSyncServices/syncGroups', parameters('FilesyncName'), parameters('syncgroupname'))]",
"[resourceId('microsoft.storagesync/storageSyncServices', parameters('FilesyncName'))]",
"[resourceId('microsoft.storagesync/storageSyncServices/registeredServers', parameters('FilesyncName'), 'rs')]"
],
"properties": {
"serverLocalPath": "F:\",
"cloudTiering": "On",
"volumeFreeSpacePercent": 20,
"tierFilesOlderThanDays": 7,
"friendlyName": "XXXX",
"serverResourceId": "[resourceId('microsoft.storagesync/storageSyncServices/registeredServers', parameters('FilesyncName'), 'rs')]",
"offlineDataTransfer": "On",
"offlineDataTransferShareName": "fsnew",
"initialDownloadPolicy": "NamespaceOnly",
"localCacheMode": "UpdateLocallyCachedFiles"
}
}*
上述资源类型和用于添加服务器端点的ARM TEMPLATE。 此模板不会触发配置服务器端点。想看看 same.TIA
的例子我看不出有什么理由不这样做。它只是 Azure ARM api.
中的常规提供程序以下是部署存储同步服务、同步组和服务器端点的工作 ARM 模板。
当您按照 serverResourceId
属性,但 ResourceId 格式为:
/subscriptions/***/resourceGroups/***/providers/microsoft.storagesync/storageSyncServices/mystoragesyncservice/registeredServers/85fa92da-2b2e-447c-d3rg-f8bf43c4064f
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storagesyncservicename": {
"type": "string",
"defaultValue": "mystoragesyncservice"
}
},
"variables": {},
"resources": [
{
"type": "microsoft.storagesync/storageSyncServices",
"apiVersion": "2020-03-01",
"name": "[parameters('storagesyncservicename')]",
"location": "westus2",
"properties": {
"incomingTrafficPolicy": "AllowAllTraffic"
}
},
{
"type": "microsoft.storagesync/storageSyncServices/syncGroups",
"apiVersion": "2020-03-01",
"name": "[concat(parameters('storagesyncservicename'), '/mystoragesyncgroup')]",
"dependsOn": [
"[resourceId('microsoft.storagesync/storageSyncServices', parameters('storagesyncservicename'))]"
],
"properties": {}
},
{
"type": "microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints",
"apiVersion": "2020-03-01",
"name": "[concat(parameters('storagesyncservicename'), '/mystoragesyncgroup/5770750b-a1e6-4910-9781-1482fdee757a')]",
"dependsOn": [
"[resourceId('microsoft.storagesync/storageSyncServices/syncGroups', parameters('storagesyncservicename'), 'mystoragesyncgroup')]",
"[resourceId('microsoft.storagesync/storageSyncServices', parameters('storagesyncservicename'))]"
],
"properties": {
"serverLocalPath": "D:\Data",
"cloudTiering": "Off",
"volumeFreeSpacePercent": 20,
"friendlyName": "mytestafs",
"serverResourceId": "/subscriptions/***/resourceGroups/***/providers/microsoft.storagesync/storageSyncServices/mystoragesyncservice/registeredServers/85fa92da-2b2e-447c-d3rg-f8bf43c4064f",
"offlineDataTransfer": "Off",
"initialDownloadPolicy": "NamespaceThenModifiedFiles",
"localCacheMode": "UpdateLocallyCachedFiles"
}
}
]
}