ARM Template - How to reference a copyIndex() deployment output?

社会主义新天地 提交于 2020-01-05 08:29:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!