如何在手臂模板中使用嵌套副本

时间:2018-11-07 20:25:17

标签: json azure azure-devops azure-pipelines arm-template

我正在为多个环境创建多个资源策略(Recovery Service Vault中的备份策略)。我能够为一种环境创建它们,如何使用嵌套副本进行质量检查来复制它们。

它们的策略名称为AZR-QA-SQL-1Hour-Policy-001

感谢您的帮助。

  "variables": {
    "sqlDevPolicyName": [
      "[concat('AZR-DEV-SQL-1HOUR-POLICY-001')]",
      "[concat('AZR-DEV-SQL-4HOUR-POLICY-001')]",
      "[concat('AZR-DEV-SQL-8HOUR-POLICY-001')]"
    ]
    }
  }

"resources": [
    {
      "type": "Microsoft.RecoveryServices/vaults",
      "apiVersion": "2018-01-10",
      "name": "[parameters('vaultName')]",
      "location": "[parameters('location')]",
      "sku": {
        "name": "RS0",
        "tier": "Standard"
      },
      "properties": {}
    },
    {
      "apiVersion": "2018-01-10",
      "name": "[concat(parameters('vaultName'), '/', variables('sqlPolicyName')[copyIndex()])]",
      "type": "Microsoft.RecoveryServices/vaults/backupPolicies",
      "dependsOn": [
        "[concat('Microsoft.RecoveryServices/vaults/', parameters('vaultName'))]"
      ],
      "copy": {
        "name": "policies",
        "count": "[length(variables('sqlDevPolicyName'))]"
      },
      "location": "[parameters('location')]",
      "properties": {
        "backupManagementType": "AzureWorkload",
        "protectedItemsCount": 0,
        "settings": {
          "isCompression": false,
          "issqlcompression": false,
          "timeZone": "[parameters('timeZone')]"
        },
        "subProtectionPolicy": [
          {
            "policyType": "Full",
            "retentionPolicy": {
              "retentionPolicyType": "LongTermRetentionPolicy",
              "weeklySchedule": {
                "daysOfTheWeek": [
                  "Sunday"
                ],
                "retentionDuration": {
                  "count": 15,
                  "durationType": "Weeks"
                },
                "retentionTimes": "[parameters('scheduleRunTimes')]"
              }
            },

1 个答案:

答案 0 :(得分:0)

根据我对您所说内容的理解,您需要执行以下操作:

result

至少这是我的看法