Azure ARM Template: DependsOn conditional statement Azure ARM Template: DependsOn conditional statement json json

Azure ARM Template: DependsOn conditional statement


ok, first of all, you can depend on existence of something (strictly speaking), you can only depend on resource being created successfully in the same (!!) template. so if your template has this structure:

resource1 - nested templateresource2 - nested templateresource3 - the one you are asking about

you just need to use this as dependsOn:

"dependsOn": [    "resource1",    "resource2"]

but, as your question reads: "resource will deploy on if either nestedTemplateA exists already OR if nestedTemplateB exists already." its really hard for me to be sure I'm answering the right question. if this is not what you are asking about, can you please comment on this answer if you need more help (and, perhaps, rephrase your question). I'll edit this answer, cheers!


As of today, Azure has added support for the conditional dependsOn in Define the order for deploying resources in ARM templates

This allows for the exact feature you are looking for. That is to say: You can simply add all conditional dependencies in the depondsOn array. Those dependencies evaluated as false will be removed.