trying to do some extra tweaks to my ps1 script that deploys vm by using an arm template.
the script asks if an availability zone is needed, if yes then gives you the zone options available. if its not needed, then the $zone variable is set to defaultvalue or null, and then that value is used in the arm template to deploy a vm without any availability zones.
my template.json file contains the following parameter for the zone.
"availabilityZone": {
"type": "array",
"defaultValue": []
the IF statement contains
"zones": "[if(empty(parameters('availabilityZone')), json('[]'), array(parameters('availabilityZone')))]"
ive also tried using the following, but it does not work
json('null')
if i hardcode the Availabilityzone then it deploys accordingly. if the Availabilityzone is left out of the deployment it will deploy into avalabilityzone 1.
If the $zone is set as 0, $null or left as blank it fails and says
Error: Code=InvalidDeploymentParameterValue; Message=The value of deployment parameter 'availabilityZone' is null. Please specify the value or use the parameter reference.
what am i missing?
cheers