需要 ARM 模板“类型”属性

问题描述 投票:0回答:1

我正在尝试从 Azure-Cli(版本 0.10.2)部署 documentDb,因此我直接从 azure 门户导出模板。

这导致了以下错误:

InvalidRequestContent:请求内容无效,无法反序列化:“在“DeploymentParameterDefinition”类型的对象上找不到成员“defaultValue”。路径'properties.parameters.arm_document_db.defaultValue'

将它们更改为“值”会导致:

InvalidDeploymentParameterType :不应指定部署参数“arm_document_db”的类型。请参阅 https://aka.ms/arm-deploy/#parameter-file 了解详细信息。

查看此页表明type为必填项,但均为小写。这给出了同样的错误。

删除“类型”然后给我这个错误:

InvalidRequestContent:请求内容无效,无法反序列化:'在 JSON 中找不到必需的属性'类型'。路径“properties.template.parameters.arm_document_db”

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
    "arm_document_db": {
        "defaultValue": null,
        "type": "SecureString"
    },
    "arm_document_db01": {
        "defaultValue": "arm-document-db01",
        "type": "String"
    }
},
"variables": {},
"resources": [
    {
        "type": "Microsoft.DocumentDB/databaseAccounts",
        "kind": "DocumentDB",
        "name": "[parameters('arm_document_db01')]",
        "apiVersion": "2015-04-08",
        "location": "Japan West",
        "tags": {},
        "properties": {
            "databaseAccountOfferType": "Standard",
            "name": "[parameters('arm_document_db')]"
        },
        "dependsOn": []
    }
]
}

aka.ms 链接显示“类型”是必需的,但错误表明不是必需的。非常感谢!

azure-cli
1个回答
0
投票

该错误不适用于 azuredeploy.json。适用于 azuredeploy.parameters.json。 从参数文件中删除“类型”字段。

© www.soinside.com 2019 - 2024. All rights reserved.