Azure ARM模板-使用其他部署的输出 [英] Azure ARM templates - using the output of other deployments

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

问题描述

我感兴趣的是读取另一个资源组中另一个部署的输出参数. 我的ARM模板类似于:

What I am interested in is reading the output parameters of another deployment in a different resource group. My ARM templates are something like:

  1. platform.json-设置DNS,虚拟网络和安全性
  2. storage.json-设置数据库和其他商店
  3. app.json-设置网络应用程序/api

每个部署在 不同 资源组中,因为它们具有不同的生命周期.但是,当我部署app.json时,我想获取最新平台和存储部署的输出,并使用它们来配置应用.

Each is deployed in different resource groups as they have different life cycles. However, when I deploy the app.json I want to pull in the outputs of the latest platform and storage deployments and use them to configure the app.

链接模板不是解决方案,因为链接模板最终部署在与应用程序相同的资源组中,这违反了将资源隔离在资源组中的目的.

Linked templates are not a solution as the linked templates end up deployed in the same resource group as the app which defeats the purpose of segregating your resources in resource groups.

有什么方法可以从其他资源组读取部署的输出参数?如果没有,Azure打算支持它吗?

Is there any way I can read the output parameters of a deployment from a different resource group? if not, is Azure planning to support it?

我知道有一种方法可以使用resourceId函数通过id获取资源,并查看其属性,但我试图避免这样做,以免陷入资源引用垃圾邮件中.

I know there is a way to get the resources by id, using the resourceId function, and look at their properties but I am trying to avoid doing that to not get into a resource reference spagetti.

推荐答案

您如何进行部署?在PowerShell中,您可以执行以下操作:

How are you doing your deployments? In PowerShell you can do something like:

(Get-AzureResourceGroupDeployment NameOfResourceGroup).Outputs.NameOfOuputProperty.Value

这将为您提供最新部署的输出.您还可以将整个部署对象放入var中,然后使用它.

And that will give you the output of the most recent deployment. You can also throw the entire deployment object into a var and have at it that way.

$d = Get-AzureResourceGroupDeployment NameOfResourceGroup

如果您需要许多输出属性,那会更快.

Which would be faster if you needed a many output properties.

有帮助吗?

语法大致相同:

(Get-AzureRmResourceGroupDeployment -ResourceGroupName NameOfResourceGroup -Name NameOfDeployment).Outputs.NameOfOutputProperty.value

如果您有多个部署,则可以使用:

If you have multiple deployments you can use:

Get-AzureRmResourceGroupDeployment -ResourceGroupName NameOfResourceGroup 

要全部查看并查看名称...

To see them all and see what the names are...

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

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