title: The resource is not defined in the template
body: <p>Deploying below template:</p>
  <p><a href="https://gist.github.com/rnkhouse/aea0a8fd395da37b19466348b919d620" rel="noreferrer">https://gist.github.com/rnkhouse/aea0a8fd395da37b19466348b919d620</a></p>
  <pre><code>{
      &quot;$schema&quot;: &quot;https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#&quot;,
      &quot;contentVersion&quot;: &quot;1.0.0.0&quot;,
      &quot;parameters&quot;: {
          &quot;location&quot;: {
              &quot;type&quot;: &quot;String&quot;
          },
          &quot;virtualNetworkName&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;metadata&quot;: {
              &quot;description&quot;: &quot;This is the name of the Virtual Network&quot;
          }
          },
          &quot;networkInterfaceName&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;metadata&quot;: {
              &quot;description&quot;: &quot;This is the prefix name of the Network interfaces&quot;
          }
          },
          &quot;loadBalancerName&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;metadata&quot;: {
              &quot;description&quot;: &quot;This is the name of the load balancer&quot;
          }
          },
          &quot;adminUsername&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;metadata&quot;: {
              &quot;description&quot;: &quot;Admin username&quot;
          }
          },
          &quot;adminPublicKey&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;metadata&quot;: {
              &quot;description&quot;: &quot;SSH Public Key&quot;
          }
          },
          &quot;imagePublisher&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;defaultValue&quot;: &quot;Canonical&quot;,
          &quot;metadata&quot;: {
              &quot;description&quot;: &quot;Image Publisher&quot;
          }
          },
          &quot;vmNamePrefix&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;metadata&quot;: {
              &quot;description&quot;: &quot;Prefix to use for VM names&quot;
          }
          },
          &quot;imageOffer&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;defaultValue&quot;: &quot;UbuntuServer&quot;,
          &quot;metadata&quot;: {
              &quot;description&quot;: &quot;Image Offer&quot;
          }
          },
          &quot;imageSKU&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;defaultValue&quot;: &quot;14.04.5-LTS&quot;,
          &quot;metadata&quot;: {
              &quot;description&quot;: &quot;Image SKU&quot;
          }
          },
          &quot;vmStorageAccountContainerName&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;defaultValue&quot;: &quot;vhds&quot;,
          &quot;metadata&quot;: {
              &quot;description&quot;: &quot;This is the storage account container name&quot;
          }
          },
          &quot;storageAccountName&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;metadata&quot;: {
              &quot;description&quot;: &quot;Storage account name&quot;
          }
          },
          &quot;vmSize&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;defaultValue&quot;: &quot;Standard_D1&quot;,
          &quot;metadata&quot;: {
              &quot;description&quot;: &quot;This is the allowed list of VM sizes&quot;
          }
          },
          &quot;subnetName&quot;: {
              &quot;defaultValue&quot;: &quot;subnet-2&quot;,
              &quot;type&quot;: &quot;String&quot;
          }
      },
      &quot;variables&quot;: {
          &quot;availabilitySetName&quot;: &quot;[concat(parameters('subnetName'),'-AVSET')]&quot;,
          &quot;addressPrefix&quot;: &quot;1.0.0.0/16&quot;,
          &quot;subnetPrefix&quot;: &quot;1.0.2.0/24&quot;,
          &quot;storageAccountType&quot;: &quot;Standard_LRS&quot;,
          &quot;vnetID&quot;: &quot;[resourceId(resourceGroup().name,'Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]&quot;,
          &quot;subnetRef&quot;: &quot;[concat(variables('vnetID'),'/subnets/',parameters ('subnetName'))]&quot;,
          &quot;numberOfInstances&quot;: 2,
          &quot;lbID&quot;: &quot;[resourceId('Microsoft.Network/loadBalancers',parameters('loadBalancerName'))]&quot;
      },
      &quot;resources&quot;: [
          {
          &quot;apiVersion&quot;: &quot;2015-05-01-preview&quot;,
          &quot;type&quot;: &quot;Microsoft.Storage/storageAccounts&quot;,
          &quot;name&quot;: &quot;[parameters('storageAccountName')]&quot;,
          &quot;location&quot;: &quot;[parameters('location')]&quot;,
          &quot;properties&quot;: {
              &quot;accountType&quot;: &quot;[variables('storageAccountType')]&quot;
          }
          },
          {
          &quot;apiVersion&quot;: &quot;2016-04-30-preview&quot;,
          &quot;type&quot;: &quot;Microsoft.Compute/availabilitySets&quot;,
          &quot;name&quot;: &quot;[variables('availabilitySetName')]&quot;,
          &quot;location&quot;: &quot;[parameters('location')]&quot;,
          &quot;properties&quot;: {
              &quot;platformFaultDomainCount&quot;: &quot;2&quot;,
              &quot;platformUpdateDomainCount&quot;: &quot;2&quot;,
              &quot;managed&quot;: &quot;true&quot;
          }
          },
          {
          &quot;apiVersion&quot;: &quot;2015-05-01-preview&quot;,
          &quot;type&quot;: &quot;Microsoft.Network/virtualNetworks/subnets&quot;,
          &quot;name&quot;: &quot;[concat(parameters('virtualNetworkName'), '/', parameters('subnetName'))]&quot;,
          &quot;location&quot;: &quot;[parameters('location')]&quot;,
          &quot;properties&quot;: {
              &quot;addressPrefix&quot;: &quot;[variables('subnetPrefix')]&quot;
          }
          },
          {
          &quot;apiVersion&quot;: &quot;2015-05-01-preview&quot;,
          &quot;type&quot;: &quot;Microsoft.Network/networkInterfaces&quot;,
          &quot;name&quot;: &quot;[concat(parameters('networkInterfaceName'), copyindex())]&quot;,
          &quot;location&quot;: &quot;[parameters('location')]&quot;,
          &quot;copy&quot;: {
              &quot;name&quot;: &quot;nicLoop&quot;,
              &quot;count&quot;: &quot;[variables('numberOfInstances')]&quot;
          },
          &quot;dependsOn&quot;: [
              &quot;[concat('Microsoft.Network/loadBalancers/', parameters('loadBalancerName'))]&quot;
          ],
          &quot;properties&quot;: {
              &quot;ipConfigurations&quot;: [
              {
                  &quot;name&quot;: &quot;ipconfig1&quot;,
                  &quot;properties&quot;: {
                  &quot;privateIPAllocationMethod&quot;: &quot;Dynamic&quot;,
                  &quot;subnet&quot;: {
                      &quot;id&quot;: &quot;[variables('subnetRef')]&quot;
                  },
                  &quot;loadBalancerBackendAddressPools&quot;: [
                      {
                      &quot;id&quot;: &quot;[concat(variables('lbID'), '/backendAddressPools/BackendPool1')]&quot;
                      }
                  ]
                  }
              }
              ]
          }
          },
          {
          &quot;apiVersion&quot;: &quot;2015-05-01-preview&quot;,
          &quot;type&quot;: &quot;Microsoft.Network/loadBalancers&quot;,
          &quot;name&quot;: &quot;[parameters('loadBalancerName')]&quot;,
          &quot;location&quot;: &quot;[parameters('location')]&quot;,
          &quot;dependsOn&quot;: [],
          &quot;properties&quot;: {
              &quot;frontendIPConfigurations&quot;: [
              {
                  &quot;properties&quot;: {
                  &quot;subnet&quot;: {
                      &quot;id&quot;: &quot;[variables('subnetRef')]&quot;
                  },
                  &quot;privateIPAddress&quot;: &quot;1.0.2.50&quot;,
                  &quot;privateIPAllocationMethod&quot;: &quot;Static&quot;
                  },
                  &quot;name&quot;: &quot;LoadBalancerFrontend&quot;
              }
              ],
              &quot;backendAddressPools&quot;: [
              {
                  &quot;name&quot;: &quot;BackendPool1&quot;
              }
              ],
              &quot;loadBalancingRules&quot;: [
              {
                  &quot;properties&quot;: {
                  &quot;frontendIPConfiguration&quot;: {
                      &quot;id&quot;: &quot;[concat(resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancerName')), '/frontendIpConfigurations/LoadBalancerFrontend')]&quot;
                  },
                  &quot;backendAddressPool&quot;: {
                      &quot;id&quot;: &quot;[concat(resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancerName')), '/backendAddressPools/BackendPool1')]&quot;
                  },
                  &quot;probe&quot;: {
                      &quot;id&quot;: &quot;[concat(resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancerName')), '/probes/lbprobe')]&quot;
                  },
                  &quot;protocol&quot;: &quot;Tcp&quot;,
                  &quot;frontendPort&quot;: 80,
                  &quot;backendPort&quot;: 80,
                  &quot;idleTimeoutInMinutes&quot;: 15
                  },
                  &quot;Name&quot;: &quot;lbrule&quot;
              }
              ],
              &quot;probes&quot;: [
              {
                  &quot;properties&quot;: {
                  &quot;protocol&quot;: &quot;Tcp&quot;,
                  &quot;port&quot;: 80,
                  &quot;intervalInSeconds&quot;: 15,
                  &quot;numberOfProbes&quot;: 2
                  },
                  &quot;name&quot;: &quot;lbprobe&quot;
              }
              ]
          }
          },
          {
          &quot;apiVersion&quot;: &quot;2016-04-30-preview&quot;,
          &quot;type&quot;: &quot;Microsoft.Compute/virtualMachines&quot;,
          &quot;name&quot;: &quot;[concat(parameters('vmNamePrefix'), copyindex())]&quot;,
          &quot;copy&quot;: {
              &quot;name&quot;: &quot;virtualMachineLoop&quot;,
              &quot;count&quot;: &quot;[variables('numberOfInstances')]&quot;
          },
          &quot;location&quot;: &quot;[parameters('location')]&quot;,
          &quot;dependsOn&quot;: [
              &quot;[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]&quot;,
              &quot;[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'), copyindex())]&quot;,
              &quot;[concat('Microsoft.Compute/availabilitySets/', variables('availabilitySetName'))]&quot;
          ],
          &quot;properties&quot;: {
              &quot;availabilitySet&quot;: {
              &quot;id&quot;: &quot;[resourceId('Microsoft.Compute/availabilitySets',variables('availabilitySetName'))]&quot;
              },
              &quot;hardwareProfile&quot;: {
              &quot;vmSize&quot;: &quot;[parameters('vmSize')]&quot;
              },
              &quot;osProfile&quot;: {
              &quot;computerName&quot;: &quot;[concat(parameters('vmNamePrefix'), copyIndex())]&quot;,
              &quot;adminUsername&quot;: &quot;[parameters('adminUsername')]&quot;,
              &quot;linuxConfiguration&quot;: {
                  &quot;disablePasswordAuthentication&quot;: &quot;true&quot;,
                  &quot;ssh&quot;: {
                      &quot;publicKeys&quot;: [
                          {
                              &quot;path&quot;: &quot;[concat('/home/', parameters('adminUsername'), '/.ssh/authorized_keys')]&quot;,
                              &quot;keyData&quot;: &quot;[parameters('adminPublicKey')]&quot;
                          }
                      ]
                  }
              }
              },
              &quot;storageProfile&quot;: {
              &quot;imageReference&quot;: {
                  &quot;publisher&quot;: &quot;[parameters('imagePublisher')]&quot;,
                  &quot;offer&quot;: &quot;[parameters('imageOffer')]&quot;,
                  &quot;sku&quot;: &quot;[parameters('imageSKU')]&quot;,
                  &quot;version&quot;: &quot;latest&quot;
              },
              &quot;osDisk&quot;: {
                  &quot;createOption&quot;: &quot;FromImage&quot;
              }
              },
              &quot;networkProfile&quot;: {
              &quot;networkInterfaces&quot;: [
                  {
                  &quot;id&quot;: &quot;[resourceId('Microsoft.Network/networkInterfaces',concat(parameters('networkInterfaceName'),copyindex()))]&quot;
                  }
              ]
              },
              &quot;diagnosticsProfile&quot;: {
              &quot;bootDiagnostics&quot;: {
                  &quot;enabled&quot;: &quot;true&quot;,
                  &quot;storageUri&quot;: &quot;[concat('http://',parameters('storageAccountName'),'.blob.core.windows.net')]&quot;
              }
              }
          }
          }
      ]
  }
  </code></pre>
  <p>Error:</p>
  <blockquote>
  <p>&quot;Deployment failed with status code: 400 and message: Deployment template validation failed: 'The resource 'Microsoft.Network/virtualNetworks/mtes-dev-VNET' is not defined in the template. Please see <a href="https://aka.ms/arm-template" rel="noreferrer">https://aka.ms/arm-template</a> for usage details.'.&quot;</p>
  </blockquote>
  <p>I have already created Virtual Network in other template and using same resource group here. But, still I am getting above error. Please advice!</p>