I am trying to deploy a Recovery Services Vault next to a Storage account and a Sync Service. Everything goes through correctly, but my Backup Retention Policy keeps throwing an error back with "Parameter NO_PARAM in request is invalid. Please provide correct value for parameter NO_PARAM" and the policy doesn't get created on the Azure side. I've narrowed the issue down to being something related to the "scheduleRunTimes" parameter, but I feel like I've followed the Microsoft Templates and other templates on the web 1:1.
Here is my .json template:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageName": {
"type": "string"
},
"storageLocation": {
"type": "string"
},
"syncName": {
"type": "string"
},
"recoveryName": {
"type": "string"
},
"policyName": {
"type": "string"
},
"scheduleRunTime": {
"type": "string",
"defaultValue": "03:30",
"metadata": {
"description": "Time of day when backup should be triggered in 24 hour HH:MM format, where MM must be 00 or 30. (Ignore if using existing Backup Policy)."
}
}
},
"functions": [],
"variables": {
"scheduleRunTimes": [
"[format('2020-01-01T{0}:00Z', parameters('scheduleRunTime'))]"
]
},
"resources": [
{
"name": "[parameters('storageName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2021-04-01",
"location": "[parameters('storageLocation')]",
"kind": "StorageV2",
"sku": {
"name": "Standard_LRS"
}
},
{
"type": "Microsoft.StorageSync/storageSyncServices",
"apiVersion": "2020-09-01",
"name": "[parameters('syncName')]",
"location": "[parameters('storageLocation')]",
"properties": {}
},
{
"type": "Microsoft.RecoveryServices/vaults",
"apiVersion": "2022-04-01",
"name": "[parameters('recoveryName')]",
"sku": {
"name": "RS0",
"tier": "Standard"
},
"location": "[parameters('storageLocation')]",
"properties": {}
},
{
"type": "Microsoft.RecoveryServices/vaults/backupPolicies",
"apiVersion": "2022-06-01-preview",
"name": "[concat(parameters('recoveryName'), '/', parameters('policyName'))]",
"dependsOn": [ "[concat('Microsoft.RecoveryServices/vaults/', parameters('recoveryName'))]" ],
"location": "[parameters('storageLocation')]",
"properties": {
"backupManagementType": "AzureStorage",
"workLoadType": "AzureFileShare",
"schedulePolicy": {
"scheduleRunFrequency": "Daily",
"scheduleRunTimes": "[variables('scheduleRunTimes')]",
"schedulePolicyType": "LongTermSchedulePolicy"
},
"timeZone": "UTC",
"retentionPolicy": {
"retentionPolicyType": "LongTermRetentionPolicy",
"dailySchedule": {
"retentionTimes": "[variables('scheduleRunTimes')]",
"retentionDuration": {
"count": 30,
"durationType": "Days"
}
},
"weeklySchedule": {
"retentionDuration": {
"count": 5,
"durationType": "Weeks"
},
"daysOfTheWeek": ["Sunday"],
"retentionTimes": "[variables('scheduleRunTimes')]"
},
"monthlySchedule": {
"retentionDuration": {
"count": 13,
"durationType": "Months"
},
"retentionScheduleDaily": {
"daysOfTheMonth": [
{
"date": 1,
"isLast": false
}
]
},
"retentionScheduleWeekly": {
"daysOfTheWeek": ["Sunday"],
"weeksOfTheMonth": ["First"]
},
"retentionScheduleFormatType": "Daily",
"retentionTimes": "[variables('scheduleRunTimes')]"
},
"yearlySchedule": {
"monthsOfYear": ["January"],
"retentionDuration": {
"count": 10,
"durationType": "Years"
},
"retentionScheduleDaily": {
"daysOfTheMonth": [
{
"date": 1,
"isLast": false
}
]
},
"retentionScheduleWeekly": {
"daysOfTheWeek": ["Sunday"],
"weeksOfTheMonth": ["First"]
},
"retentionScheduleFormatType": "Daily",
"retentionTimes": "[variables('scheduleRunTimes')]"
}
}
}
}
],
"outputs": {}
}
And here is the .ps1 powershell for deploying:
Connect-AzAccount
$subName = Read-Host -Prompt "Enter the Subscription ID to use for deployment"
Set-AzContext -Subscription $subName
$officeName = Read-Host -Prompt "Enter the Office code I.E AMS, LDN or CPH"
$rgName = "RG-$officeName-FileSync"
$storageName = "afs$officeName"
$syncName = "$officeName-file-sync"
$recoveryName = "$officeName-AFSRecoveryVault"
$storageLocation = Read-Host -Prompt "Enter the desired Azure location for the AFS deployment"
$policyName = "scrapedforanynomity"
New-AzResourceGroup -Name $rgName -Location $storageLocation -Force
New-AzResourceGroupDeployment `
-Name 'AFS-deployment2' `
-ResourceGroupName $rgName `
-TemplateFile 'C:\Users\Guldhammeren\Documents\Visual Studio Code\lasse.guldhammer\afs-01.json' `
-storageName $storageName `
-syncName $syncName `
-storageLocation $storageLocation `
-recoveryName $recoveryName `
-policyName $policyName `
-scheduleRunTime "03:00"
I simply can't figure out why it won't work? Appreciate any help!
I've already tried to enter the time as another format, but this results in another error code saying "InvalidUserRequestInput". So this means to me that the format is correct?