You have to use the object variables to use the parameters conditionally, so you have to do something like this:
{
"$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"
]
},
"sqlDatabaseMaxCapacity": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"sqlSkuTier-Var": "[if(equals(parameters('sqlSkuName'), 'BasicPool'), 'Basic',
if(equals(parameters('sqlSkuName'), 'StandardPool'), 'Standard',
if(equals(parameters('sqlSkuName'), 'PremiumPool'), 'Premium',
'')))]",
"sqlDatabaseMaxCapacity-var": "[if(equals(parameters('sqlDatabaseMaxCapacity'),0 ),
if(equals(parameters('sqlSkuName'), 'BasicPool'), 5,50),
parameters('sqlDatabaseMaxCapacity'))]"
},
"resources": []
}
And then to use the value:
variables('sqlSkuTier-Var')
I recommend that you use the visual studio code plugin( https://marketplace.visualstudio.com/items?itemName=msazurermtools.azurerm-vscode-tools) to have IntelliSense, it helps a lot to work and see what you have wrong.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…