ARM模板中的预定义资源组 [英] Predefined Resource Group in ARM Template

查看:90
本文介绍了ARM模板中的预定义资源组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究自定义手臂模板.

I'm working on a custom arm template.

我想在JSON内使用特定的资源组进行硬编码,因此 打开模板时,它将模拟资源组:使用现有的:预定义的选定资源组"

I would like to have specific resource group to be hard coded inside the JSON so when opening the template it will simulate "Resource Group: Use existing: predefined selected Resource group"

我已经花了好几个小时不停地搜寻网络,我也尝试导出现有资源组模板并将其导入到自定义部署中,但是它仍然显示

I've been scratching my head for hours and searched the web deeply, I also tried to export existing resource group template and import it to custom deployment but it still shows

资源组*新建*使用现有

Resource Group *Create New *Use Existing

有什么方法可以在JSON模板中定义现有的RG?

Is there any way to define existing RG inside the JSON template?

推荐答案

有几种方法可以实现此目的(虽然不是很有意义,但是您可以这样做).

there are several ways to achieve this (not that it makes sense, but you can do this).

  1. 围绕模板使用自动化,以始终将其部署到相同的rg.这是最有意义的,因为您的模板保持灵活
  2. 用父模板包装模板(以便将模板转换"为嵌套模板).这样,父模板可以控制将嵌套模板部署到哪个资源组(查找跨资源组ARM模板部署).
  3. 使您的模板成为嵌套的嵌入式模板(最坏的情况).这与第2点几乎相同,但更糟糕的是,因为嵌套的内联模板具有以下特殊缺陷:无法使用自己的参数\变量,只能使用父级中定义的参数.

同样,这一切都没有道理,因为您应该将其部署到正确的subscription \ resource组组合中.但是如果您坚持的话,就可以了.

Again, none of this makes sense as you should just deploy it to the proper subscription\resource group combination. but there you have it, if you insist.

但是门户体验将保持不变(无法解决此问题,您可以强制模板始终部署到同一资源组(这没有任何意义),但不能改变门户体验) ,如果那就是您所关心的.

But the portal experience will stay the same (there is no way of working around that, you can forcé the template to always deploy to the same resource group (not that it makes any sense), but not alter the portal experience), if thats what you are concerned about.

这篇关于ARM模板中的预定义资源组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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