使用PowerShell脚本部署模板失败

时间:2019-09-06 12:21:38

标签: azure-iot-hub azure-template

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "storageAccountType": {
      "type": "string",
      "defaultValue": "eNtsaBuilding M103",
      "metadata": {
        "description": "Storage Account type"
      }
    }
  },
  "variables": {
    "MandelaUniversity2019": "[concat(uniquestring(resourceGroup().id), 'standardsa')]"
  },
  "resources": [
    {
      "type": "Microsoft.Storage/eNtsaResourcesIOT",
      "name": "[variables('MandelaUniversity2019')]",
      "apiVersion": "2018-01-06",
      "location": "[resourceGroup().location]",
      "sku": {
        "name": "[parameters('storageAccountType')]"
      },
      "kind": "Storage",
      "properties": {

      }
    }
  ],
  "outputs": {
    "MandelaUniversity2019": {
      "type": "string",
      "value": "[variables('MandelaUniversity2019')]"
    }
  }
}
14:16:57 - 2:16:56 PM - Resource Microsoft.Storage/eNtsaResourcesIOT 'fi7so6zmvqa2istandardsa' failed with message '{
14:16:57 -   "error": {
14:16:57 -     "code": "InvalidResourceType",
14:16:57 -     "message": "The resource type could not be found in the namespace 'Microsoft.Storage' for api version '2018-01-06'."
14:16:57 -   }
14:16:57 - }'

我该如何解决此问题,我正在尝试使用VS 2019创建模板,并且我的deploymentJSON脚本指出了该错误。请协助,因为我不知道是的invalidResourceType,但是我的门户网站确实有该Resource类型。在此JSON脚本上应该添加或修改任何内容吗?请指导我解决此问题,谢谢。

1 个答案:

答案 0 :(得分:0)

如评论中所述,使用此:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "storageAccountType": {
      "type": "string",
      "defaultValue": "eNtsaBuilding M103",
      "metadata": {
        "description": "Storage Account type"
      }
    }
  },
  "variables": {
    "MandelaUniversity2019": "[concat(uniquestring(resourceGroup().id), 'standardsa')]"
  },
  "resources":[ 
     { 
        "type":"Microsoft.Storage/storageAccounts",
        "name":"[variables('storageAccountName')]",
        "apiVersion":"2018-07-01",
        "location":"eastus",
        "sku":{ 
           "name":"Standard_LRS",
           "tier":"Standard"
        },
        "kind":"Storage",
        "properties":{ 

        }
     }
  ],
  "outputs": {
    "MandelaUniversity2019": {
      "type": "string",
      "value": "[variables('MandelaUniversity2019')]"
    }
  }
}