question

HOJ-8253 avatar image
0 Votes"
HOJ-8253 asked ·

Create Recovery Service Vault with policy using ARM Template

Hi,
I'm trying to create an ARM template to create RSV with a default Backup policy. The vault is created, but the creation of the policy fails with the below error:

Status Message: Input for create or update policy is not in proper format
Please check format of parameters like schedule time, schedule days, retention time and retention days (Code:BMSUserErrorInvalidPolicyInput)
Status Message: Parameter value in request is invalid
Please provide correct value for parameter value (Code:UserErrorInvalidRequestParameter)

My template is like this:

 {
     "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
     "contentVersion": "1.0.0.0",
     "parameters": {
         "CustomerID": {
             "type": "int",
             "minValue":100000,
             "maxValue":999999,
             "metadata": {
                 "description": "Customer ID, 6 digits"
             }
         },
         "CustomerSubID": {
             "type": "int",
             "minValue":1,
             "maxValue":99,
             "metadata": {
                 "description": "Customer Sub ID, one or two dgits"
             }
         },
         "location": {
             "type": "string",
             "defaultValue": "[resourceGroup().location]",
             "metadata": {
                 "description": "Location for Resources"
             }
         },
         "date": {
             "type": "string",
             "defaultValue": "[utcNow('yyyy-MM-dd')]",
             "metadata": {
                 "description": "Date in format yyyy-MM-dd"
             }
         },
         "timeZone": {
             "type": "string",
             "defaultValue": "UTC",
             "metadata": {
                 "description": "Any Valid timezone, for example:UTC, Pacific Standard Time. Refer: https://msdn.microsoft.com/en-us/library/gg154758.aspx"
             } 
         },
         "time2": {
             "type": "string",
             "defaultValue": "2021-03-08T22:00:00Z"
         }
     },
     "functions": [],
     "variables": {
         "recoveryvaultName": "[toLower(concat('azpnoe','-rsv-',parameters('CustomerID'),'-',padLeft(parameters('CustomerSubID'),2,'0')))]",
         "time": "[concat(parameters('date'), 'T22:00:00Z')]"
     },
     "resources": [
         {
             "name": "[variables('recoveryvaultName')]",
             "type": "Microsoft.RecoveryServices/vaults",
             "apiVersion": "2016-06-01",
             "location": "[parameters('location')]",
             "tags": {
                 "CustomerID": "[parameters('CustomerID')]"
             },
             "sku": {
                 "name": "RS0",
                 "tier": "Standard"
             },
             "properties": {
             }
         },
         {
             "name": "[concat(variables('recoveryvaultName'),'/VM-Policy')]",
             "type": "Microsoft.RecoveryServices/vaults/backupPolicies",
             "apiVersion": "2016-06-01",
             "dependsOn": [
                 "[resourceId('Microsoft.RecoveryServices/vaults', variables('recoveryvaultName'))]"
             ],
             "location": "[parameters('location')]",
             "properties": {
                 "backupManagementType": "AzureIaasVM",
                 "instantRpRetentionRangeInDays": 2,
                 "schedulePolicy": {
                     "schedulePolicyType": "SimpleSchedulePolicy",
                     "scheduleRunFrequency": "Daily",
                     "scheduleRunTimes": [
                         "[variables('time')]"
                     ],
                     "scheduleWeeklyFrequency": 0
                 },
                 "retentionPolicy": {
                     "retentionPolicyType": "LongTermRetentionPolicy",
                     "dailySchedule": {
                         "retentionTimes": [
                             "[variables('time')]"
                         ],
                         "retentionDuration": {
                             "count": 5,
                             "durationType": "Days"
                         }
                     },
                     "weeklySchedule": {
                         "daysOfTheWeek": [
                             "Friday"
                         ],
                         "retentionTimes": [
                             "[variables('time')]"
                         ],
                         "retentionDuration": {
                             "count": 6,
                             "durationType": "Weeks"
                         }
                     }
                 },
                 "timeZone": "[parameters('timeZone')]"
             }
         }
     ],
     "outputs": {}
 }

I get the same error when trying to create using the Quickstart template "Create Daily Backup Policy for RS Vault to protect IaaSVMs"


azure-backupazure-virtual-machines-backup
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

sajjadali-2433 avatar image
0 Votes"
sajjadali-2433 answered ·

@HOJ-8253 retention dailybackups should be 7 days, so change the count to 7 days and try again


What is the minimum allowed retention range for a daily backup point?
Azure Virtual Machine backup policy supports a minimum retention range from seven days up to 9999 days. Any modification to an existing VM backup policy with less than seven days will require an update to meet the minimum retention range of seven days.

https://docs.microsoft.com/en-us/azure/backup/backup-azure-vm-backup-faq#what-is-the-minimum-allowed-retention-range-for-a-daily-backup-point

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@sajjadali-2433 Thanks for the answer.

That resolved the issue

0 Votes 0 ·