You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure备份保留策略部署报NO_PARAM错误,请求排查scheduleRunTimes问题

问题:Azure备份保留策略部署失败,错误提示NO_PARAM参数无效

我在Azure中部署Recovery Services Vault、存储账户和同步服务,前两者部署正常,但备份保留策略始终抛出错误**“Parameter NO_PARAM in request is invalid. Please provide correct value for parameter NO_PARAM”,导致策略无法在Azure端创建。我已将问题范围缩小至与scheduleRunTimes参数相关,且严格参照微软官方及公开模板配置;尝试修改时间格式会触发“InvalidUserRequestInput”**错误。以下是我的ARM模板及PowerShell部署脚本,恳请协助排查问题原因。

ARM模板

{
    "$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": {}
}

PowerShell部署脚本

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"
排查与解决方案

核心问题分析

  1. 调度策略类型错误:Azure文件共享的日常备份主调度策略应使用SimpleSchedulePolicy,而非LongTermSchedulePolicy。LongTermSchedulePolicy仅用于长期保留的子调度配置,不能作为顶层调度策略类型,这是触发NO_PARAM错误的主要原因。
  2. 冗余配置导致参数解析异常:在monthlySchedule和yearlySchedule中,同时配置了retentionScheduleDaily和retentionScheduleWeekly,但retentionScheduleFormatType仅指定了一种格式(Daily),冗余的配置会导致Azure API无法正确解析参数,进而抛出模糊的NO_PARAM错误。
  3. 预览版API兼容性问题:使用的2022-06-01-preview预览版API可能存在未公开的参数校验逻辑,建议切换至稳定版API以避免此类问题。

具体修正步骤

1. 修改调度策略类型

将schedulePolicy中的schedulePolicyType改为SimpleSchedulePolicy:

"schedulePolicy": {
    "scheduleRunFrequency": "Daily",
    "scheduleRunTimes": "[variables('scheduleRunTimes')]",
    "schedulePolicyType": "SimpleSchedulePolicy"
},

2. 清理冗余的保留策略配置

删除monthlySchedule和yearlySchedule中未启用的调度格式配置,以monthlySchedule为例:

"monthlySchedule": {
    "retentionDuration": {
        "count": 13,
        "durationType": "Months"
    },
    "retentionScheduleDaily": {
        "daysOfTheMonth": [
            {
                "date": 1,
                "isLast": false
            }
        ]
    },
    "retentionScheduleFormatType": "Daily",
    "retentionTimes": "[variables('scheduleRunTimes')]"
},

同理删除yearlySchedule中的retentionScheduleWeekly节点。

3. 切换至稳定版API

将备份策略的apiVersion改为稳定版,例如2023-01-01:

{
    "type": "Microsoft.RecoveryServices/vaults/backupPolicies",
    "apiVersion": "2023-01-01",
    ...
}

4. 验证时间格式

当前scheduleRunTimes的拼接方式是正确的,但可以直接使用完整的ISO字符串避免拼接风险,例如将变量改为:

"variables": {
    "scheduleRunTimes": ["2020-01-01T03:00:00Z"]
}

验证部署

修改完成后,重新运行PowerShell部署脚本,即可正常创建备份保留策略。

内容的提问来源于stack exchange,提问作者Lasse Emil Guldhammer Sørensen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.29 04:37:07