circular dependency

saravanan a r 40 Reputation points
2024-02-16T12:29:22.5666667+00:00

I have created atemplate for  load balancer with two virtual machines with public ip and availability set in single zone. When I deployed in azure portal it shows error of “circular dependency of vm1 for this resource group.Please give me the solution to overcome the circular dependency.  

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

1 answer

Sort by: Most helpful
  1. ChaitanyaNaykodi-MSFT 27,476 Reputation points Microsoft Employee Moderator
    2024-02-17T04:50:32.9833333+00:00

    @saravanan a r

    Thank you for reaching out.

    Cany you please let us know if you are using ARM to deploy the LB with 2 VMS?

    As documented here you receive circular dependency error when resources depend on each other in a way that prevents the deployment from starting. A combination of interdependencies makes two or more resources wait for other resources that are also waiting. For example, resource1 depends on resource3, resource2 depends on resource1, and resource3 depends on resource2. You can usually solve this problem by removing unnecessary dependencies.

    To solve a circular dependency:

    1. In your template, find the resource identified in the circular dependency.
    2. For that resource, examine the dependsOn property and any uses of the reference or resourceId functions to see which resources it depends on.
    3. Examine those resources to see which resources they depend on. Follow the dependencies until you notice a resource that depends on the original resource.
    4. For the resources involved in the circular dependency, carefully examine all uses of the dependsOn property to identify any dependencies that aren't needed. To troubleshoot the deployment, remove the circular dependencies. Rather than delete the code, you can use comments so that the code doesn't run during the next deployment. You can use single-line comments (//) or multi-line comments (/* ... */) in ARM templates or Bicep files.
    5. Redeploy the template.

    Hope this helps!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.