I am defining some parameters to configure my SQL Database elastic pool in my ARM template. I would like to specify defaults for each parameter, with the second and third parameters' default values being based on the first parameter's value. However, I'm getting errors whenever I attempt to specify expressions as the default values of parameters that have an allowed set of values: "This value is not one of the allowed values for parameter '…'." The same happens for parameters that have a type other than string: "Parameter '…' must be of type '…'.".
I can work around the issue by eliminating the allowed values, and by changing all parameter types to string. However, this would lose the validation for user-input values. Am I doing something wrong when defining the default values, or is this an ARM limitation?
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"sqlSkuName": {
"type": "string",
"allowedValues": [
"BasicPool",
"StandardPool",
"PremiumPool"
],
"defaultValue": "StandardPool"
},
"sqlSkuTier": {
"type": "string",
"allowedValues": [
"Basic",
"Standard",
"Premium"
],
"defaultValue": "[if(equals(parameters('sqlSkuName'), 'BasicPool'), 'Basic',
if(equals(parameters('sqlSkuName'), 'StandardPool'), 'Standard',
if(equals(parameters('sqlSkuName'), 'PremiumPool'), 'Premium',
'')))]"
},
"sqlDatabaseMaxCapacity": {
"type": "int",
"defaultValue": "[if(equals(parameters('sqlSkuName'), 'BasicPool'), 5, 50)]"
},
}
}