1
votes

I have a parent ARM Template (eg: myapp.assembly.json) that invokes linked child ARM Templates (web.serverFarm.json, web.site.json, etc.)

Currently I have defined the relationship between linked child templates by putting dependsOn

  • in the parent ARM template
  • referencing the name of the linked Microsoft.Resources/deployments (and not the names of resources created within the linked resource template).

I was expecting:

  • any Microsoft.Resources/deployments that had a dependsOn defined for another Microsoft.Resources/deployments would wait till all those resources are created.

What I think I am observing is:

  • the first time the ARM template is run, it reports that the deployment fails ...looking for dependencies...
  • but continues working...so can't redeploy immediately...
  • the second time, the resources are built, and the deployment completes.

It's entirely possible I'm missing a dependsOn -- although I've really looked and don't think so -- or the dependsOn is not being honored in the way I would have expected.

Any advice would be appreciated.

Thanks.

1
show the template - 4c74356b41
You're correct in that you dependsOn the deployment resource... the dependsOn property is only for resources defined in the same template. The behavior you're seeing is strongly indicative of missing a dependsOn somewhere... - bmoore-msft

1 Answers

0
votes

Agh! Thank you @ 4c74356b41 and @bmoore-msft ... you were absolutely correct (it was right in front of my nose for an embarrassing amount of days :-( )

I must have copy/pasted from the child resource template to the parent assembly template.

"webSiteConfigAppSettingsApplicationInsightsInstrumentationKey": {
  // FIX: Rely on the template instead of direct:"value": "[reference(resourceId('Microsoft.Insights/components', variables('insights').components.resourceName), '2015-05-01').InstrumentationKey]"
  "value": "[reference(variables('insights').components.armTemplateId).outputs.instrumentationKey.value]"
}

ie: I needed to reference the template and it's output. Not the resource created within the template...which the parent template could not see.

All works smooth as butter now.