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

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

问题描述

我通过 copyIndex() 部署了 30 个 SQL 数据库作为主部署的子部署,我希望能够在启动另一个部署时引用动态部署的输出.部署所有数据库后,我想将所有 Azure Monitor 指标规则发送到 DB,并需要它们的 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天全站免登陆