0

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.

Vy Do
  • 46,709
  • 59
  • 215
  • 313

1 Answers1

0

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.

Jahnavi
  • 3,076
  • 1
  • 3
  • 10