Azure ARM 部署 - TemplateLink 不是现有的语言表达式 属性

Azure ARM deployment - TemplateLink not an existing language expression property

我正在尝试将防火墙部署到 Azure。当我在 Jenkins 中验证模板时,它说一切都很好。当我尝试 运行 模板时,此时出现错误:

  "name": "SettingUpVirtualNetwork",
  "type": "Microsoft.Resources/deployments",
  "apiVersion": "2017-05-10",
  "properties": {
    "mode": "Incremental",
    "templateLink": {
      "uri": "[uri(deployment().properties.templateLink.uri, 'vnet.json')]",
      "contentVersion": "1.0.0.1"

错误为:

"Unable to process template language expressions for resource '/subscriptions/****/resourceGroups/networks-hub-rg/providers/Microsoft.Resources/deployments/SettingUpVirtualNetwork' at line '1' and column '6637'. 'The language expression property 'templateLink' doesn't exist, available properties are 'template, parameters, mode, provisioningState'.'"

现在 Azure 指南明确指出 templateLink 是完全有效的。我之前使用过 templateLink 命令没有问题,所以我不明白为什么这次失败了。是因为我在 uri 行中使用了 "templateLink.uri" 吗?

有人遇到过这个错误吗?有什么建议吗?

当涉及到 ARM 模板部署中的意外行为时,我总是尝试检查 API 版本。对于您的情况,我会尝试使用以下代码:

  "name": "SettingUpVirtualNetwork",
  "type": "Microsoft.Resources/deployments",
  "apiVersion": "2018-05-01",
  "properties": {
    "mode": "Incremental",
    "templateLink": {
      "uri": "[uri(deployment().properties.templateLink.uri, 'vnet.json')]",
      "contentVersion": "1.0.0.1"

https://docs.microsoft.com/en-us/azure/templates/microsoft.resources/2018-05-01/deployments

发生这种情况是因为您需要从 uri 而不是本地存储部署模板,如果您这样做 - 您的代码将起作用