Outputs and Cross-Template Communication
What You'll Learn
You'll learn how to pass deployment results between ARM templates using outputs, enabling coordinated multi-template deployments where one template's results feed into another.
The Core Idea
Think of outputs like a finished product's shipping label — they package up information from a deployment so other templates can read and use it. When you deploy infrastructure across multiple ARM templates, they often need to share data. For example, Template A might create a virtual network, and Template B needs that network's resource ID to deploy VMs into it.
Outputs let you declare which values should be exposed after a template runs. These values can then be:
- Displayed in the deployment results
- Consumed by other templates through cross-template references
- Used in automation scripts
How It Works
You've already learned about the outputs section and linked templates. Now combine them: one template's output becomes another template's input parameter.
Template A defines an output:
"outputs": {
"vnetId": {
"type": "string",
"value": "[resourceId('Microsoft.Network/virtualNetworks', 'myVNet')]"
}
}
Template B receives this as a parameter, which you pass when linking templates or during deployment orchestration. This creates a dependency chain where templates execute in sequence, each building on the previous deployment's results.
This pattern is crucial for modular infrastructure: networking team deploys foundation, compute team references those outputs, security team layers on top — all coordinated through outputs.
Key Takeaway: Outputs turn deployment results into shareable data, enabling multiple ARM templates to communicate and build complex infrastructure in coordinated layers.