I am trying to create linked ARM tempIates using Visual Studio. For creating a VM I need to pass the variable for vnet prefix, subnet name etc to a different template using a parameter file or a template file. I couldn't get a relevant example in the microsoft site. Please help.
Asked
Active
Viewed 568 times
1 Answers
0
There is a well defined way of doing this. You have a 'deployment' resource in your template that references another template with a uri.
"resources": [
{
"name": "myNestedTemplate",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(variables('template').base, 'nested/', variables('template').nested2)]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"apiVersion": {
"value": "[variables('sharedState')]"
}
}
}
So you need to have the other template accessible. In Visual studio, you can make sure it gets uploaded along with the rest of your artifacts to the storage account.
Check out Mark van Eijk's blog for this particular solution, but also the quick start templates on GitHub are a great resource for finding how to do something.
Also, you must've not looked very hard on the msft website...: Linked Template Example on msft

Edward Rixon
- 1,199
- 1
- 17
- 31