0

I have a requirement to provision a VM in azure based on selected parameter/variable value.

Consider, if user selected the variable value as 'yes' then VM should get provisioned with availability set. if user selected 'no' then VM should get provisioned without availability set.

May I know, how we can achieve this using single ARM Template?

Thanks in Advance! Regards, Narendran

  • 1
    Only way I can think of would require you to use multiple templates: Using conditionals in the ARM Template based on the selected value, then depending on which option is selected, link off to a different ARM Template. – Andy T Oct 05 '17 at 18:38

1 Answers1

1

Its quite easy, here is a sample of doing this:

"availabilitySet": "[if(equals(parameters('availabilitySet'),'yes'), variables('availabilitySet'), json('null'))]",

complete example here.

4c74356b41
  • 69,186
  • 6
  • 100
  • 141