Grouping parameters

An important recent update to ARM templates was the usage of the object data type to parameters. A parameter of the object type can accept any valid JSON from external resources as its input at runtime. This helps colocate parameters for a resource and helps form a natural grouping of properties. The same parameter can also define a default object if the external source does not provide a value for this parameter.

Grouping parameters is also a workaround to overcome the limitation of 255 parameters in a template.

Grouping using objects makes it easy for a caller to specify parameter values, which is much more intuitive and easier to comprehend the parameters. For example, we could group all storage-related parameters so that they aren't scattered throughout an ARM template.

Once object parameters are defined, they can be referenced from within any section of the template. A complete example using the object parameter to provision a storage account is shown next.

The ARM Template code is as follows:

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountConfiguration": {
"type" : "object",
"defaultValue" : {
"name" : "sdw543fggsdfsd",
"apiVersion" : "2018-02-01",
"sku" : {
"name" : "Standard_LRS"
}
}
}
},
"variables": {
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('storageAccountConfiguration').name]",
"apiVersion": "[parameters('storageAccountConfiguration').apiVersion]",
"location": "[resourceGroup().location]",
"sku": {
"name": "[parameters('storageAccountConfiguration').sku.name]",
},
"kind": "Storage"
}
],

"outputs": {
"storageDetails": {
"type": "string",
"value": "[concat(parameters('storageAccountConfiguration').name, parameters('storageAccountConfiguration').sku.name)]"
}
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.204.201