0

Could you please assist me to take Backup using Recovery Service vault of Azure file shares. If there is an ARM template to achieve the same , that will also work.

This links states that in future we'll have this however no update later on.

https://social.msdn.microsoft.com/Forums/azure/en-US/0f27868c-585f-4e56-885e-bbcf4bf299ff/backup-azure-fileshares-with-recovery-services-vault?forum=windowsazureonlinebackup

{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
    "location": {
        "type": "string",
        "defaultValue": "canadacentral",
        "metadata": {
            "description": "The region where Azure will house the deployment."
        },
        "minLength": 5
    }
},
"variables": {
    "namespace": "jira",
    "jira": {
        "storage": {
            "name": "[concat(variables('namespace'), 'storage', uniqueString(resourceGroup().id))]",
            "sharedHomeName": "[concat(variables('namespace'), '-shared-home')]",
            "diagnostics": "[concat(variables('namespace'), 'diag', uniqueString(resourceGroup().id))]",
            "skuName": "Premium_LRS",
            "skuTier": "Premium"
        }
    },
    "vaultName": "[concat(variables('namespace'), '-vault-', uniqueString(resourceGroup().id))]",
    "policyName": "SharedHomeBackupPolicy",
    "schedule": {
        "scheduleRunFrequency": "Daily",
        "scheduleRunDays": null,
        "scheduleRunTimes": [
            "2020-01-01T10:00:00.000Z"
        ],
        "schedulePolicyType": "SimpleSchedulePolicy"
    },
    "retention": {
        "dailySchedule": {
            "retentionTimes": [
                "2020-01-01T10:00:00.000Z"
            ],
            "retentionDuration": {
                "count": 30,
                "durationType": "Days"
            }
        },
        "weeklySchedule": null,
        "monthlySchedule": null,
        "yearlySchedule": null,
        "retentionPolicyType": "LongTermRetentionPolicy"
    },
    "timeZone": "UTC",
    "fabricName": "Azure",
    "protectionContainers": "[array(concat('storagecontainer;storage;', resourceGroup().name, ';', variables('jira').storage.name))]",
    "sharedHomeSizeInGb": "128",
    "protectedItems": "[array(concat('azurefileshare;', variables('jira').storage.sharedHomeName))]",
    "skuName": "RS0",
    "skuTier": "Standard"
},
"resources": [
    {
        "type": "Microsoft.Storage/storageAccounts",
        "comments": "Only have this resource in this template because not allowed to return keys/secrets in output pararms.",
        "apiVersion": "2019-06-01",
        "name": "[variables('jira').storage.name]",
        "location": "[parameters('location')]",
        "sku": {
            "name": "[variables('jira').storage.skuName]",
            "tier": "[variables('jira').storage.skuTier]"
        },
        "kind": "FileStorage",
        "properties": {
            "largeFileSharesState": "Enabled",
            "networkAcls": {
                "bypass": "AzureServices",
                "defaultAction": "Allow"
            },
            "supportsHttpsTrafficOnly": true,
            "encryption": {
                "services": {
                    "file": {
                        "keyType": "Account",
                        "enabled": true
                    },
                    "blob": {
                        "keyType": "Account",
                        "enabled": true
                    }
                },
                "keySource": "Microsoft.Storage"
            }
        }
    },
    {
        "type": "Microsoft.Storage/storageAccounts/fileServices",
        "apiVersion": "2019-06-01",
        "name": "[concat(variables('jira').storage.name, '/default')]",
        "dependsOn": [
            "[resourceId('Microsoft.Storage/storageAccounts', variables('jira').storage.name)]"
        ],
        "sku": {
            "name": "[variables('jira').storage.skuName]"
        }
    },
    {
        "type": "Microsoft.Storage/storageAccounts/fileServices/shares",
        "apiVersion": "2019-06-01",
        "name": "[concat(variables('jira').storage.name, '/default/', variables('jira').storage.sharedHomeName)]",
        "dependsOn": [
            "[resourceId('Microsoft.Storage/storageAccounts/fileServices', variables('jira').storage.name, 'default')]",
            "[resourceId('Microsoft.Storage/storageAccounts', variables('jira').storage.name)]"
        ],
        "properties": {
            "shareQuota": "[variables('sharedHomeSizeInGb')]"
        }
    },
    {
        "type": "Microsoft.RecoveryServices/vaults",
        "apiVersion": "2018-01-10",
        "name": "[variables('vaultName')]",
        "location": "[parameters('location')]",
        "dependsOn": [
            "[resourceId('Microsoft.Storage/storageAccounts/fileServices/shares', variables('jira').storage.name, 'default', variables('jira').storage.sharedHomeName)]"
        ],
        "sku": {
            "name": "[variables('skuName')]",
            "tier": "[variables('skuTier')]"
        },
        "properties": {}
    },
    {
        "type": "Microsoft.RecoveryServices/vaults/backupPolicies",
        "apiVersion": "2019-05-13",
        "name": "[concat(variables('vaultName'), '/', variables('policyName'))]",
        "dependsOn":[
            "[resourceId('Microsoft.RecoveryServices/vaults', variables('vaultName'))]"
        ],
        "properties": {
            "backupManagementType": "AzureStorage",
            "WorkloadType": "AzureFileShare",
            "schedulePolicy": "[variables('schedule')]",
            "retentionPolicy": "[variables('retention')]",
            "TimeZone": "[variables('timeZone')]"
        }
    },
    {
        "type": "Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems",
        "apiVersion": "2019-05-13",
        "name": "[concat(variables('vaultName'), '/', variables('fabricName'), '/',variables('protectionContainers')[copyIndex()], '/', variables('protectedItems')[copyIndex()])]",
        "dependsOn": [
            "[concat('Microsoft.RecoveryServices/vaults', '/', variables('vaultName'), '/backupPolicies/', variables('policyName'))]"
        ],
        "properties": {
            "backupManagementType": "AzureStorage",
            "workloadType": "AzureFileShare",
            "protectedItemType": "AzureFileShareProtectedItem",
            "policyId": "[resourceId('Microsoft.RecoveryServices/vaults/backupPolicies', variables('vaultName'), variables('policyName'))]",
            "sourceResourceId": "[resourceId('Microsoft.Storage/storageAccounts',variables('jira').storage.name)]"
        },
        "copy": {
            "name": "protectedItemsCopy",
            "count": "[length(variables('protectedItems'))]"
        }
    }
],
"outputs": {
}

}

4

1 回答 1

0

试试下面的模板 -

更新:用于为带有备份项的 Azure 文件共享添加备份策略的模板。

模板:

{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "vaultName": {
            "type": "String"
        },
        "policyName": {
            "type": "String"
        },
        "schedule": {
            "type": "Object"
        },
        "retention": {
            "type": "Object"
        },
        "timeZone": {
            "type": "String"
        },
        "fabricName": {
            "type": "String"
        },
        "protectionContainers": {
            "type": "Array"
        },
        "protectedItems": {
            "type": "Array"
        },
        "sourceResourceIds": {
            "type": "Array"
        }
    },
    "resources": [
        {
            "type": "Microsoft.RecoveryServices/vaults/backupPolicies",
            "apiVersion": "2016-06-01",
            "name": "[concat(parameters('vaultName'), '/', parameters('policyName'))]",
            "properties": {
                "backupManagementType": "AzureStorage",
                "WorkloadType": "AzureFileShare",
                "schedulePolicy": "[parameters('schedule')]",
                "retentionPolicy": "[parameters('retention')]",
                "TimeZone": "[parameters('timeZone')]"
            }
        },
        {
            "type": "Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems",
            "apiVersion": "2016-06-01",
            "name": "[concat(parameters('vaultName'), '/', parameters('fabricName'), '/',parameters('protectionContainers')[copyIndex()], '/', parameters('protectedItems')[copyIndex()])]",
            "dependsOn": [
                "[concat('Microsoft.RecoveryServices/vaults', '/', parameters('vaultName'), '/backupPolicies/', parameters('policyName'))]"
            ],
            "properties": {
                "backupManagementType": "AzureStorage",
                "workloadType": "AzureFileShare",
                "friendlyName": "afs",
                "protectedItemType": "AzureFileShareProtectedItem",
                "policyId": "[resourceId('Microsoft.RecoveryServices/vaults/backupPolicies', parameters('vaultName'), parameters('policyName'))]",
                "sourceResourceId": "[parameters('sourceResourceIds')[copyIndex()]]"
            },
            "copy": {
                "name": "protectedItemsCopy",
                "count": "[length(parameters('protectedItems'))]"
            }
        }
    ]
}

参数:

   {
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "vaultName": {
            "value": "recoveryvaulttest"
        },
        "policyName": {
            "value": "DailyPolicy"
        },
        "schedule": {
            "value": {
                "scheduleRunFrequency": "Daily",
                "scheduleRunDays": null,
                "scheduleRunTimes": [
                    "2020-07-03T20:30:00.000Z"
                ],
                "schedulePolicyType": "SimpleSchedulePolicy"
            }
        },
        "retention": {
            "value": {
                "dailySchedule": {
                    "retentionTimes": [
                        "2020-07-03T20:30:00.000Z"
                    ],
                    "retentionDuration": {
                        "count": 30,
                        "durationType": "Days"
                    }
                },
                "weeklySchedule": null,
                "monthlySchedule": null,
                "yearlySchedule": null,
                "retentionPolicyType": "LongTermRetentionPolicy"
            }
        },
        "timeZone": {
            "value": "UTC"
        },
        "fabricName": {
            "value": "Azure"
        },
        "protectionContainers": {
            "value": [
                "storagecontainer;storage;<resource group name>;<storage account name>"
            ]
        },
        "protectedItems": {
          "value": [
            "azurefileshare;<azure file share name>"
          ]
        },
        "sourceResourceIds": {
            "value": [
                "<Resource ID of storage account>"
            ]
        }
    }
}

您可以根据需要更新参数。

于 2020-07-03T12:22:04.867 回答