部署模板验证失败参数文件中的模板参数“scriptUrldsc"无效,它们不存在于原始文件中 [英] Deployment template validation failed template parameters 'scriptUrldsc' in the parameters file are not valid they are not present in the original

查看:13
本文介绍了部署模板验证失败参数文件中的模板参数“scriptUrldsc"无效,它们不存在于原始文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到了该主题中提到的错误,我正在努力修复它.我正在使用带有多个嵌套 ARM 模板的 ARM 模板,部署是使用 Azure DevOps 完成的.

I'm receiving the error mentioned on the subject, and I'm struggling to fix it. I'm using an ARM template with several nested ARM templates, the deployment is being done using Azure DevOps.

在模板下方.

第一个模板是调用嵌套模板的模板:

This first template is the one calling the nested ones:

{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
  "existingDataFactoryName": {
    "type": "string",
    "metadata": {
      "description": "Existing Data Factory name"
    }
  },
  "existingDataFactoryResourceGroup": {
    "type": "string",
    "metadata": {
      "description": "Existing Data Factory resource group"
    }
  },
  "existingDataFactoryVersion": {
    "type": "string",
    "metadata": {
      "description": "Select the existing Data Factory version"
    },
    "allowedValues": [
      "V1",
      "V2"
    ]
  },
  "virtualMachineName": {
    "type": "string",
    "metadata": {
      "description": "Virtual Machine Name where the runtime will run. Please don't provide the last numbers of the VM E.g: EUWE01PROJNIR "
    }
  },
  "IntegrationRuntimeName": {
    "type": "string",
    "metadata": {
      "description": "IR name must be unique in subscription"
    }
  },
  "NodeCount": {
    "type": "int",
    "maxValue": 4,
    "minValue": 1,
    "metadata": {
      "description": "the node count is between 1 and 4."
    }
  },
  "vmSize": {
    "type": "string",
    "defaultValue": "Standard_A4_v2"
  },
  "adminUserName": {
    "type": "string",
    "metadata": {
      "description": "User name for the virtual machine"
    }
  },
  "adminPassword": {
    "type": "securestring",
    "metadata": {
      "description": "Password for the virtual machine"
    }
  },
  "existingVirtualNetworkName": {
    "type": "string",
    "metadata": {
      "description": "Existing vnet name"
    }
  },
  "existingVnetLocation": {
    "type": "string",
    "metadata": {
      "description": "Virtual machine will be create in the same datacenter with VNET"
    }
  },
    "existingVnetResourceGroupName": {
    "type": "string",
    "metadata": {
      "description": "Name of the existing VNET resource group"
    }
  },
  "existingSubnetInYourVnet": {
    "type": "string",
    "metadata": {
      "description": "Name of the subnet in the virtual network you want to use"
    }
  },
  "_artifactsLocation": {
    "type": "string",
    "metadata": {
      "description": "The base URI where artifacts required by this template are located."
    },
    "defaultValue": "[deployment().properties.templateLink.uri]"
  },
  "_artifactsLocationSasToken": {
    "type": "securestring",
    "metadata": {
      "description": "The sasToken required to access _artifactsLocation.  When the template is deployed using the accompanying scripts, a sasToken will be automatically generated."
    },
    "defaultValue": ""
  },
  "diagnosticsStorageAccountName": {
    "type": "string",
    "metadata": {
      "description": "Diagnostic storage account name"
    },
    "defaultValue": ""
  },
    "storageAccountNameRG": {
    "type": "string",
    "metadata": {
      "description": "Diagnostic Resource Group of the Diagnostic storage account"
    },
    "defaultValue": ""
  },
    "availabilitySetName": {
    "type": "string",
    "metadata": {
      "description": "Availability Set Name"
    },
    "defaultValue": ""
  }

},
"variables": {
  "delimiters": [
    "-",
    "_"
  ],      

  "prefix": "[split(parameters('IntegrationRuntimeName'), variables('delimiters'))[0]]",
  "vmTemplateLink": "[uri(parameters('_artifactsLocation'), concat('nested/VMtemplate.json', parameters('_artifactsLocationSasToken')))]",
  "irInstallTemplateLink": "[uri(parameters('_artifactsLocation'), concat('nested/IRInstall.json', parameters('_artifactsLocationSasToken')))]",
  "IRtemplateLink": "[uri(parameters('_artifactsLocation'), concat('nested/IRtemplate.json', parameters('_artifactsLocationSasToken')))]",
  "subnetId": "[resourceId(parameters('existingVnetResourceGroupName'), 'Microsoft.Network/virtualNetworks/subnets', parameters('existingVirtualNetworkName'), parameters('existingSubnetInYourVnet'))]",
  "scriptURL": "[uri(parameters('_artifactsLocation'), concat('gatewayInstall.ps1', parameters('_artifactsLocationSasToken')))]",
  "scriptURLdsc": "[uri(parameters('_artifactsLocation'), concat('DscMetaConfigs.ps1', parameters('_artifactsLocationSasToken')))]"
},
"resources": [
  {
    "type": "Microsoft.Resources/deployments",
    "apiVersion": "2019-09-01",
    "name": "nestedTemplate",
    "resourceGroup": "[parameters('existingDataFactoryResourceGroup')]",
    "properties": {
      "mode": "Incremental",
      "templateLink": {
        "uri": "[variables('IRtemplateLink')]",
        "contentVersion": "1.0.0.0"
      },
      "parameters": {
        "existingDataFactoryName": {
          "value": "[parameters('existingDataFactoryName')]"
        },
        "existingDataFactoryVersion": {
          "value": "[parameters('existingDataFactoryVersion')]"
        },
        "IntegrationRuntimeName": {
          "value": "[parameters('IntegrationRuntimeName')]"
        }
      }
    }
  },
  {
    "type": "Microsoft.Resources/deployments",
    "apiVersion": "2019-09-01",
    "name": "[concat('VMtemplate-', copyIndex())]",
    "dependsOn": [
      "[resourceId(parameters('existingDataFactoryResourceGroup'), 'Microsoft.Resources/deployments', 'nestedTemplate')]"
    ],
    "copy": {
      "name": "vmcopy",
      "count": "[parameters('NodeCount')]"
    },
    "properties": {
      "mode": "Incremental",
      "templateLink": {
        "uri": "[variables('vmTemplateLink')]",
        "contentVersion": "1.0.0.0"
      },
      "parameters": {
        "virtualMachineName": {
          "value": "[take(concat(parameters('virtualMachineName'),'0',copyIndex(1)), 15)]"
        },
        "vmSize": {
          "value": "[parameters('vmSize')]"
        },
        "adminUserName": {
          "value": "[parameters('adminUserName')]"
        },
        "adminPassword": {
          "value": "[parameters('adminPassword')]"
        },
        "existingVnetLocation": {
          "value": "[parameters('existingVnetLocation')]"
        },
        "subnetId": {
          "value": "[variables('subnetId')]"
        },
        "diagnosticsStorageAccountName": {
          "value": "[parameters('diagnosticsStorageAccountName')]"
        },
        "availabilitySetName": {
        "value":  "[parameters('availabilitySetName')]"
        },
        "storageAccountNameRG": {
          "value":  "[parameters('storageAccountNameRG')]"
        }
      }
    }
  },
  {
    "apiVersion": "2019-09-01",
    "type": "Microsoft.Resources/deployments",
    "name": "[concat('IRInstalltemplate-', copyIndex())]",
    "dependsOn": [
      "vmcopy"
    ],
    "copy": {
      "name": "irinstallcopy",
      "count": "[parameters('NodeCount')]",
      "mode": "serial"
    },
    "properties": {
      "mode": "Incremental",
      "templateLink": {
        "uri": "[variables('irInstallTemplateLink')]",
        "contentVersion": "1.0.0.0"
      },
      "parameters": {
        "existingDataFactoryVersion": {
          "value": "[parameters('existingDataFactoryVersion')]"
        },
        "datafactoryId": {
          "value": "[reference(resourceId(parameters('existingDataFactoryResourceGroup'), 'Microsoft.Resources/deployments', 'nestedTemplate')).outputs.irId.value]"
        },
        "virtualMachineName": {
          "value": "[take(concat(parameters('virtualMachineName'),'0',copyIndex(1)), 15)]"
        },
        "existingVnetLocation": {
          "value": "[parameters('existingVnetLocation')]"
        },
        "scriptUrl": {
          "value": "[variables('scriptURL')]"
        },
        "scriptUrldsc": {
          "value": "[variables('scriptURLdsc')]"
        }
      }
    }
  }
]

}

这是在嵌套模板中使用scriptUrldsc"参数的地方.

And this one is where "scriptUrldsc" parameter is being used inside of the nested template.

{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
  "existingDataFactoryVersion": {
    "type": "string"
  },
  "datafactoryId": {
    "type": "string"
  },
  "virtualMachineName": {
    "type": "string"
  },
  "existingVnetLocation": {
    "type": "string"
  },
  "scriptUrl": {
    "type": "string"
  },
  "scriptUrldsc": {
    "type": "string"
  }
},
"variables": {},
"resources": [
  {
    "type": "Microsoft.Compute/virtualMachines/extensions",
    "name": "[concat(parameters('virtualMachineName'), '/' ,parameters('virtualMachineName'), '-installGW')]",
    "apiVersion": "2019-07-01",
    "location": "[parameters('existingVnetLocation')]",
    "tags": {
      "virtualMachineName": "[parameters('virtualMachineName')]"
    },
    "properties": {
      "publisher": "Microsoft.Compute",
      "type": "CustomScriptExtension",
      "typeHandlerVersion": "1.7",
      "autoUpgradeMinorVersion": true,
      "settings": {
        "fileUris": [
          "[parameters('scriptURL')]",
          "[parameters('scripturldsc')]"
        ]
      },
      "protectedSettings": {
        "commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -File gatewayInstall.ps1', if(equals(parameters('existingDataFactoryVersion'), 'V2'), listAuthKeys(parameters('datafactoryId'), '2017-09-01-preview').authKey1, listAuthKeys(parameters('datafactoryId'), '2015-10-01').key1))]"
      }
    }
  }
]

}

推荐答案

错误信息说存储 blob 中的 ARM 模板缺少参数 scriptUrldsc.假设最近添加了参数 scriptUrldsc,也许模板已在本地更新以添加参数,但不知何故,存储 blob 中的版本没有使用新参数更新.

The error message says that the ARM template in the storage blob is missing the parameter scriptUrldsc. Assuming the parameter scriptUrldsc was added recently, perhaps the template has been updated locally to add the parameter but somehow the version in the storage blob did not get updated with the new parameter.

错误消息说来自存储的 ARM 模板具有以下参数:

The error message says the ARM template from storage has the following parameters:

...
"parameters": {
  "existingDataFactoryVersion": {
    "type": "string"
  },
  "datafactoryId": {
    "type": "string"
  },
  "virtualMachineName": {
    "type": "string"
  },
  "existingVnetLocation": {
    "type": "string"
  },
  "scriptUrl": {
    "type": "string"
  }
},
"variables": {},
...

我很难调试和确定,但请仔细检查存储 blob 中的 ARM 模板文件以确保它具有附加参数.

It's difficult for me to debug and know for certain, but double check the ARM template file in the storage blob to ensure it has the additional parameter.

这篇关于部署模板验证失败参数文件中的模板参数“scriptUrldsc"无效,它们不存在于原始文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆