I was trying to configure Azure file share backup using ARM template deployment. Below is the template I'm trying to deploy. First I create a backup policy then trying to configure backup for the file share.
The question is, to the template I have to pass protected items in below format. (azurefileshare;someUniqueID) (I have to pass the unique protected item ID instead of file share name). But this ID can only be retrieved after configuring the backup.
Let me know if anyone here have any idea about this.
> "protectedItems": {
> "value": [
> "azurefileshare;xxxx1f5e4535076cxxxxxxxxxxxb9ff558024ff8xxxxxxcefce6"
> ]
>
Tempate.json
> {
> "$schema":"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
> "contentVersion": "1.0.0.0",
> "parameters": {
> "vaultName": {
> "type": "String"
> },
> "vaultRG": {
> "type": "String"
> },
> "vaultSubID": {
> "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'))]"
> }
> } ] }