0
votes

I get "The template resource 'testing' for type 'Microsoft.Network/virtualNetworks/subnets' at line '1' and column '181' has incorrect segment lengths." error message when trying to deploy my ARM template. Any ideas what might be wrong with this?

{
  "apiVersion": "2017-08-01",
  "name": "nestedTemplate",
  "type": "Microsoft.Resources/deployments",
  "resourceGroup" : "[variables('ResourceGroupName')]",
  "dependsOn": [
    "[resourceId('Microsoft.Network/networkSecurityGroups', variables('NSGName'))]"
  ],
  "properties": {
    "mode" : "Incremental",
    "template": {
      "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
      "contentVersion": "1.0.0.0",
      "resources": [
        {
          "apiVersion" : "2018-03-01",
          "type": "Microsoft.Network/virtualNetworks/subnets",
          "name": "[parameters('subnetName')]",
          "location": "[resourceGroup().location]",
          "properties": {
            "addressPrefix": "[reference(resourceId(variables('ResourceGroupName'), 'Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), parameters('subnetName')), '2018-03-01').addressPrefix]",
            "networkSecurityGroup": {
              "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('NSGName'))]"
            }
          }
        },
      ]
    }
  }
}
1

1 Answers

2
votes

yeah, this tells you that your resource type is parent-resource/sub-resource and your name is just sub-resource-name, where as it should be parent-resource-name/sub-resource-name.

else it wont be able to tell where to create a subnet (it cant create a subnet without knowing which vnet to put it in).