问题
I deploy 30 SQL databases via copyIndex() as sub deployments of the main deployment, I want to be able to reference the outputs of the dynamic deployments when kicking off another deployment. Once all the databases are deployed, I want to then all Azure Monitor metric rules to the DBs, and need their resourceIds (the Output of the db deploy).
The answer here sounds exactly like what I'm trying to do, and I understand that each deployment is chained to have the output of the previous deploy. But then if I want to use the chained up "state" output, is it the very last element in the array that has the full chain? If so is the best way to reference that to just build up the name of the deployment and append on the length of the copyIndex array?
reference(concat('reference', length(variables('types'))).outputs.state.value
As so?
回答1:
yes, you basically need to construct a name that is the name of the deployment:
referenceX
where X is the number of the last deployment, you can use length()
function for that exactly as you suggest it.
the above will work only if you gather the output from all the intermediate steps, obviously
来源:https://stackoverflow.com/questions/57927815/arm-template-how-to-reference-a-copyindex-deployment-output