首页 > 解决方案 > 错误:部署参数使用区分大小写的名称。错误参数名称:名称。(ARM 模板部署)

问题描述

我正在为创建路由表创建 ARM 模板。从模板部署下载的简单 ARM 模板失败。在我运行 ARM 模板后,它会询问名称并引发以下错误。

在此处输入图像描述

我曾尝试给出 routeVnet、vnetroute 等名称。看到一些帖子在名称中给出小写大写的组合将解决问题。但它在这里不起作用。

手臂模板:

 {
        "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
        "contentVersion": "1.0.0.5",
        "parameters": {
            "name": {
                "type": "string"
            },
            "location": {
                "type": "string"
            },
            "tagsByResource": {
                "type": "object",
                "defaultValue": {},
                "metadata": {
                    "description": "Optional tags provided by the user via createUiDefinition.json"
                }
            },
            "disableBgpRoutePropagation": {
                "type": "bool"
            }
        },
        "variables": {},
        "resources": [
            {
                "apiVersion": "2019-02-01",
                "type": "Microsoft.Network/routeTables",
                "name": "[parameters('name')]",
                "location": "[parameters('location')]",
                "tags": "[ if(contains(parameters('tagsByResource'), 'Microsoft.Network/routeTables'), parameters('tagsByResource')['Microsoft.Network/routeTables'], json('{}')) ]",
                "properties": {
                    "disableBgpRoutePropagation": "[parameters('disableBgpRoutePropagation')]"
                }
            }
        ],
        "outputs": {}
    }

参数模板

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "location": {
            "value": "eastus"
        },
        "Name": {
            "value": ""
        },
        "tagsByResource": {
            "value": {}
        },
        "disableBgpRoutePropagation": {
            "value": true
        }
    }
}

标签: azurearm-templateroutetable

解决方案


问题在于您将参数名称作为 "Name"传递的参数文件,在模板中您的参数是名称,而在参数文件中您将其称为Name

正确的参数文件如下所示:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "location": {
            "value": "eastus"
        },
        "name": {
            "value": "routeVnet12"
        },
        "tagsByResource": {
            "value": {}
        },
        "disableBgpRoutePropagation": {
            "value": true
        }
    }
}

推荐阅读