英文:
How to retrieve certain resourcename in a section created in another section of JSON?
问题
"CopyUniqueNameToArmParameters": [
"vmName"
]
英文:
How does this work in JSON ARM templates?
"CopyUniqueNameToArmParameters": [
"vmName"
]
I am working with ARM template where in one section where ARM template to create virtual machine is getting called. and in that section above snippet is being used. Now in another section I need to use his vmName but not sure how it is deciding the VMName and how to retrieve it for next section.
答案1
得分: 0
CopyUniqueNameToArmParameters
是一个自定义函数,它将资源的唯一名称复制到一个 ARM 参数中。
在您的情况下,它将虚拟机的名称复制到名为 VMName
的 ARM 参数中。在另一个部分,您可以通过引用该参数名来获取 VMName
的值。
要检索 VMName
,请使用以下语法:
resources:[
{
"name": "[parameters('VMName')]"
}
]
注意: VMName
作为参数提供给需要它的资源。
传递给 CopyUniqueNameToArmParameters
的值是将存储唯一名称的 ARM 模板参数的名称。在给定情况下,唯一名称会复制到 VMName
参数中。
有关更多相关信息,请参阅MSDoc。
英文:
CopyUniqueNameToArmParameters
is a custom function that copies a resource's unique name to an ARM parameter.
In your case, it copies the virtual machine's name to an ARM parameter called VMName
. In another section, you can get the value of VMName
by referencing the parameter name.
To retrieve the VMName
, use the below syntax:
resources:[
{
"name": "[parameters('VMName')]"
}
]
Note: The VMName
is supplied as a parameter to the resource that requires it.
The value passed to CopyUniqueNameToArmParameters
is the name of the ARM template parameter that will store the unique name. The unique name is copied to the VMName
parameter in the given scenario.
Refer MSDoc for more relevant information.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论