"InvalidTemplate";消息部署模板解析失败:

"InvalidTemplate"; Message Deployment template parse failed:

部署模板时出现以下错误 错误代码 模板无效 信息 部署模板解析失败:'将值“Standard_LRS”转换为类型 'Microsoft.WindowsAzure.ResourceStack.Common.Core.Definitions.Resources.ResourceSku' 时出错。路径 ''.'.

{
              "$schema": "http://schema.management.azure.com/schemas/,2019-08-01/deploymentTemplate.json#",
              "contentVersion": "1.0.0.0",
              "parameters": {
                "locationName": {
                  "type": "string"
                },
                "StorageName": {
                  "type": "string"
                },
                "StorageKind": {
                  "type": "string"
                },
                "skuname": {
                  "type": "string"
                },
                "skutier": {
                  "type": "string"
                }
              },
              "variables": {},
              "resources": [
                {
                  "name": "[parameters('StorageName')]",
                  "type": "Microsoft.Storage/storageAccounts",
                  "apiVersion": "2021-02-01",
                  "kind": "[parameters('StorageKind')]",
                  "sku": {
                    "name": "[parameters('skuname')]",
                    "tier": "[parameters('skutier')]"
                  },
                  "location": "[parameters('locationname')]",
                  "properties": {
                    "bypass": "None",
                    "ipRules": [
                      {
                        "value": "205.145.64.0",
                        "action": "Allow"
                      },
                      {
                        "value": "205.145.64.1",
                        "action": "Allow"
                      }
                    ],
                    "defaultAction": "Allow"
                  }
                }
              ]
            }

编辑

能够部署模板但无法添加防火墙规则。

在您的模板中,您缺少添加 networkAcls 对象。 ipRules 应包含在 networkAcls 对象中,并且 defaultAction 应设置为 Deny.

test.json

{
              "$schema": "http://schema.management.azure.com/schemas/2019-08-01/deploymentTemplate.json#",
              "contentVersion": "1.0.0.0",
              "parameters": {
                "locationName": {
                  "type": "string"
                },
                "StorageName": {
                  "type": "string"
                },
                "StorageKind": {
                  "type": "string"
                },
                "skuname": {
                  "type": "string"
                },
                "skutier": {
                  "type": "string"
                }
              },
              "variables": {},
              "resources": [
                {
                  "name": "[parameters('StorageName')]",
                  "type": "Microsoft.Storage/storageAccounts",
                  "apiVersion": "2021-02-01",
                  "kind": "[parameters('StorageKind')]",
                  "sku": {
                    "name": "[parameters('skuname')]",
                    "tier": "[parameters('skutier')]"
                  },
                  "location": "[parameters('locationname')]",
                  "properties": {
                    "networkAcls": {
                        "bypass": "None",
                        "ipRules": [
                          {
                            "value": "205.145.64.0",
                            "action": "Allow"
                          },
                          {
                            "value": "205.145.64.1",
                            "action": "Allow"
                          }
                        ],
                        "defaultAction": "Deny"
                        }

                  }
                }
              ]
            }

test.parameters.json

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "locationName": {
            "value": "eastus" 
        },
        "StorageName": {
            "value": "xxxxxx" 
        },
        "StorageKind": {
            "value": "StorageV2" 
        },
        "skuname": {
            "value": "Standard_LRS" 
        },
        "skutier": {
            "value": "Standard" 
        }
    }
}