Deployment template validation failed: 'Circular dependency detected'

Ihsen Alaya 45 Reputation points
2024-01-23T08:44:43.5866667+00:00

Hi my name 'is Ihsen, I'm facing a problem with an ARM template I downloaded after creating 21 resources in one resource group. I needed to duplicate those resources so I downloaded the template from automation in the resource group and tried to redeploy but it failed and the error message " Deployment template validation failed: 'Circular dependency detected on resource: '/subscriptions/cce101e5-47ab-456d-86bb-35d89664e720/resourceGroups/ihsentest/providers/Microsoft.Compute/virtualMachines/myVM1'. Please see https://aka.ms/arm-syntax-resources for usage details.'. (Code: InvalidTemplate) it's azure generated template and it failed.

Azure Load Balancer
Azure Load Balancer
An Azure service that delivers high availability and network performance to applications.
404 questions
{count} votes

Accepted answer
  1. Luis Arias 4,871 Reputation points
    2024-01-24T16:36:55.6966667+00:00

    Hi again Ihsen,

    I removed the circular dependency commenting this line of code in all your VMs (You can finf it: line 439, 514, 589):

    // "[resourceId('Microsoft.Compute/availabilitySets', parameters('availabilitySets_myAvailabilitySet_name'))]",
    

    You had had a circular dependency between the availability set and the VMs deployment before this commenting on the dependence. So You need to comment these line and try again.

    Additional consideration before complete de deployment:

    Let me know if you have more doubts or problems (That ARM template require some modifications besides the initial error solved)

    Luis


    If the information helped address your question, please Accept the answer.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Aahana Malla 0 Reputation points
    2024-01-23T12:48:38.14+00:00

    To resolve this, you might want to review the dependencies in your template and ensure there are no circular references between resources. Check the resource dependencies and adjust them accordingly to break any circular dependencies

    0 comments No comments

  2. Aahana Malla 0 Reputation points
    2024-01-23T12:48:56.74+00:00

    To resolve this, you might want to review the dependencies in your template and ensure there are no circular references between resources. Check the resource dependencies and adjust them accordingly to break any circular dependencies

    0 comments No comments