Handling dependencies in Azure Resource Manager Linked Templates Handling dependencies in Azure Resource Manager Linked Templates azure azure

Handling dependencies in Azure Resource Manager Linked Templates


You can define the dependency either way - both are valid. Putting the dependency on the deployment resource (your second approach) will mean that the entire nested deployment is not started until the web site is provisioned. If you wanted to kick some things off in parallel, then you would put the dependency in the nested template (your first approach). That may or may not matter for your scenario, but that's a key difference.

dependsOn requires a resourceId - and as the error is trying to say, if the resource is not defined in the template you need more detail in the resourceId, in this case, you need the resourceGroup (maybe the subscription, but I doubt it). So for example you can use:

"dependsOn": [    "[resourceId(resourceGroup().name, 'Microsoft.Web/sites', parameters('siteName'))]"],


The dependsOn needs the name of the linked deployment, not one of the resources in it.

e.g.:

dependsOn: "Microsoft.Resources/deployments/myExternalTemplate"


"dependsOn": [    "[resourceId(subscription().subscriptionId, resourceGroup().name, 'Microsoft.Web/sites', parameters('siteName'))]"],