为了账号安全,请及时绑定邮箱和手机立即绑定

尝试验证任何 ARM 模板但得到:'错误将值 <...MyTemplate...> 转换为类型

尝试验证任何 ARM 模板但得到:'错误将值 <...MyTemplate...> 转换为类型

慕工程0101907 2022-06-02 11:26:15
我正在尝试验证一个手臂模板 - 任何手臂模板 - 但我总是遇到同样的错误:The request content was invalid and could not be deserialized: 'Error converting value "{...}" to type 'Microsoft.WindowsAzure.ResourceStack.Frontdoor.Templates.Schema.Template'. Path 'properties.template', line 1, position 1202.'.我在 azure 门户上创建了 ARM 模板并将其插入:#!/usr/bin/env python3                                                                                                                                                                   # https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-authoring-templates                                                                                       t='''                                                                                                                                                                                    {    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",    "contentVersion": "1",    "apiProfile": "",    "parameters": {        "testType": {            "type": "string",            "defaultValue": "Standard_LRS",            "allowedValues": [                "Standard_LRS",                "Standard_ZRS",                "Standard_GRS",                "Standard_RAGRS",                "Premium_LRS"            ]        }    },    "variables": {        "testName": "[concat('test', uniqueString(resourceGroup().id))]"    },    "functions": [],    "resources": [        {            "name": "[variables('testName')]",            "type": "Microsoft.Storage/storageAccounts",            "location": "[resourceGroup().location]",            "apiVersion": "2015-06-15",            "dependsOn": [],            "tags": {                "displayName": "test"            },            "properties": {                "accountType": "[parameters('testType')]"            }        }    ],    "outputs": {}}    
查看完整描述

1 回答

?
守候你守候我

TA贡献1802条经验 获得超10个赞

根据文档:

模板对象 模板内容。当您想直接在请求中传递模板语法而不是链接到现有模板时,您可以使用此元素。它可以是 JObject 或格式良好的 JSON 字符串。使用 templateLink 属性或模板属性,但不能同时使用两者。

但是,它需要一个 python 对象,而不是“格式良好的 JSON 字符串”。

删除模板数据周围的引号使其工作。


查看完整回答
反对 回复 2022-06-02
  • 1 回答
  • 0 关注
  • 125 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号