Circular dependency detected on resource

Mike Sarafidis 1 Reputation point
2022-11-18T12:53:26.87+00:00

We are trying to add a secondary certificate at a service fabric according to
https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-security-update-certs-azure#add-a-secondary-certificate-using-azure-resource-manager

and we are getting the following error

{"code":"InvalidTemplate","message":"Deployment template validation failed: 'Circular dependency detected on resource: '/subscriptions/xxxx/resourceGroups/xxx/providers/Microsoft.Network/loadBalancers/LB-xxx-xxx'. Please see https://aka.ms/arm-template/#resources for usage details.'."}

Azure Service Fabric
Azure Service Fabric
An Azure service that is used to develop microservices and orchestrate containers on Windows and Linux.
252 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. srbhatta-MSFT 8,546 Reputation points Microsoft Employee
    2022-11-21T03:55:08.203+00:00

    Hello @Mike Sarafidis ,
    Could you please share with us the template you are using for better understanding?

    You receive this circular dependency error when resources depend on each other in a way that prevents the deployment from starting. A combination of interdependencies makes one or more resource 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.

    ARM templates creates an implicit dependency when one resource uses the symbolic name of another resource. An explicit dependency using dependsOn usually isn't necessary.

    To solve a circular dependency:

    In your template, find the resource identified in the circular dependency.
    For that resource, examine the dependsOn property and any uses of the reference function to see which resources it depends on.
    Examine those resources to see which resources they depend on. Follow the dependencies until you notice a resource that depends on the original resource.
    For the resources involved in the circular dependency, carefully examine all uses of the dependsOn property to identify any dependencies that aren't needed. Remove those dependencies. If you're unsure that a dependency is needed, try removing it.
    Redeploy the template.
    Removing values from the dependsOn property can cause errors when you deploy the template. If you get an error, add the dependency back into the template.

    Let me know if that helps. Thank you :)

    0 comments No comments