Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created August 5, 2016 09:40
Show Gist options
  • Save justinyoo/1164ba50ea57e84db4399b07df4fcc33 to your computer and use it in GitHub Desktop.
Save justinyoo/1164ba50ea57e84db4399b07df4fcc33 to your computer and use it in GitHub Desktop.
Passing Parameters to Linked ARM Templates
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"environment": {
"type": "string",
"allowedValues": [
"dev", "test", "pprd", "prod"
]
},
"sasToken": {
"type": "string"
}
},
"variables": {
"baseTemplateUrl": "[concat('https://sa0', parameters('environment'), '.blob.core.windows.net/templates/')]",
"linkedTemplates": [
{
"name": "web-template",
"templateUrl": "[concat(variables('baseTemplateUrl'), 'app-deployment.json')]",
"parameterUrl": "[concat(variables('baseTemplateUrl'), 'app-deployment-web.params.json')]"
},
{
"name": "sql-template",
"templateUrl": "[concat(variables('baseTemplateUrl'), 'sql-deployment.json')]",
"parameterUrl": "[concat(variables('baseTemplateUrl'), 'sql-deployment.params.json')]"
}
]
},
"resources": [
{
"apiVersion": "2015-01-01",
"name": "[concat('nestedTemplate-', variables('linkedTemplates')[copyIndex()].name)]",
"type": "Microsoft.Resources/deployments",
"copy": {
"name": "templatesCopy",
"count": "[length(variables('linkedTemplates'))]"
},
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(variables('linkedTemplates')[copyIndex()].templateUrl, parameters('sasToken'))]",
"contentVersion": "1.0.0.0"
},
"parametersLink": {
"uri": "[concat(variables('linkedTemplates')[copyIndex()].parameterUrl, parameters('sasToken'))]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"environment": {
"value": "[parameters('environment')]"
}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment