ARM模板功能 [英] ARM Template Function

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

问题描述

我正在创建一个ARM模板,但是我想将一个参数的值设置为用户提供的另一个参数的值.例如,如果我提供服务结构的群集名称,我希望VNET成为群集名称-VNET"

I'm creating a ARM Template, but i'd like to have the value of a parameter to be a value of another parameter provided by the user. For instance if i provide the name of a cluster for the service fabric i'd like the VNET to be the "clustername - VNET"

目前我正在使用的功能是

At the moment the function i have been using is 

"[concat(parameters('clusterName'),'-','VNET')]"

但是这只是采用parameters.json文件中的默认值,而忽略了在模板部署期间为集群名称输入的内容.

but this then just takes the default value within the parameters.json file and ignores what is inputted for the clustername during the deployment of the template.

我认为我要面对的问题是模板类型会在模板初始化时编译/执行所有功能,因此这些功能不会重新评估/运行.

I think the problem i'm going to have is that the template kind compiles/executes all of the functions upon initialisation of the template and therefore the functions don't re-evaluate/run.

我想念什么吗?

谢谢

汤米.

推荐答案

汤米,你好,

您是否已向"clusterName"添加默认值?您的ARM模板中的参数.
这些参数始终在参数文件中的值上使用.

使用的一种很好的方法是用户定义". ARM模板中的函数来连接值和其他时髦的东西.
我已经写了一篇有关该主题的博客文章:https://azurekid.blog/2018/06/17/arm-templates-and-azure-governance/

Have you added a default value to the "clusterName" parameter in your ARM template.
These are always being used over a value from the parameters file.

A nice method to use is "User-defined" functions within your ARM template to concat values and to other funky stuff.
I've wrote a blogpost about this topic: https://azurekid.blog/2018/06/17/arm-templates-and-azure-governance/

亲切的问候,

Rogier Dijkman

Rogier Dijkman


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

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