0

I am getting below error for VMSS with custom image & elb

My template link: https://github.com/linuxgambler/azure/blob/master/vmss_elb.json

Error: "error": { "details": [ { "code": "NotFound", "message": "Resource /subscriptions/6793721a-ea46-406d-ac42-d4488d1a5c0d/resourceGroups/EMC-US-WEST/providers/Microsoft.Network/loadBalancers/AZURE-TESLB not found." } ], "code": "InvalidResourceReference", "message": "Resource /subscriptions/6793721a-ea46-406d-ac42-d4488d1a5c0d/resourceGroups/EMC-US-WEST/providers/Microsoft.Network/loadBalancers/AZURE-TESLB referenced by resource /subscriptions/6793721a-ea46-406d-ac42-d4488d1a5c0d/resourceGroups/EMC-US-West/providers/Microsoft.Compute/virtualMachineScaleSets/azure-tes was not found. Please make sure that the referenced resource exists, and that both resources are in the same region." } }

Nithin
  • 1,376
  • 12
  • 29
SAM
  • 118
  • 1
  • 11

1 Answers1

0

You need to add dependsOn property to VMSS definition.

"type": "Microsoft.Compute/virtualMachineScaleSets",
"name": "[variables('vmssName')]",
"location": "[resourceGroup().location]",
"apiVersion": "2016-04-30-preview",
"dependsOn": [
    "[variables('lbID')]"
],
"sku": {
    "name": "[parameters('vmSku')]",
    "tier": "Standard",
    "capacity": "[parameters('instanceCount')]"
},

Right now its getting created before the load balancer, that's why its erroring out.

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
  • I have added the parameter but now getting below validation error: Deployment template validation failed: 'The template resource 'Microsoft.Compute/virtualMachineScaleSets/emc-west-' cannot reference itself. Please see https://aka.ms/arm-template-expressions/#reference for usage details.'. (Code: InvalidTemplate) – SAM Jun 20 '17 at 10:12
  • i forgot to fix the typo, you obviously need to depend on the ilb, not on itself @SagarMalve – 4c74356b41 Jun 20 '17 at 11:11