亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

嘗試驗證任何 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 關注
  • 105 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號