ARM模板-如何引用copyIndex()部署输出? [英] ARM Template - How to reference a copyIndex() deployment output?

查看:99
本文介绍了ARM模板-如何引用copyIndex()部署输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过copyIndex()部署了30个SQL数据库作为主部署的子部署,我希望能够在启动另一个部署时引用动态部署的输出.部署完所有数据库之后,我想将所有Azure Monitor指标规则都发送到数据库,并需要它们的resourceId(db部署的输出).

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).

答案此处听起来完全像我要执行的操作,而且我知道每个部署都被链接在一起以具有先前部署的输出.但是,如果我要使用链接的状态"输出,是数组中具有完整链的最后一个元素吗?如果是这样的话,引用最佳方法就是建立部署名称并附加在copyIndex数组的长度上?

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

是这样吗?

推荐答案

是的,您基本上需要构造一个名称作为部署名称:

yes, you basically need to construct a name that is the name of the deployment:

referenceX

其中X是最后一次部署的编号,可以完全按照您的建议使用length()函数.

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

这篇关于ARM模板-如何引用copyIndex()部署输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆