|
2 | 2 | title: Set deployment order for resources
|
3 | 3 | description: Describes how to set one resource as dependent on another resource during deployment to ensure resources are deployed in the correct order.
|
4 | 4 | ms.topic: conceptual
|
5 |
| -ms.date: 03/20/2019 |
| 5 | +ms.date: 12/03/2019 |
6 | 6 | ---
|
7 |
| -# Define the order for deploying resources in Azure Resource Manager Templates |
| 7 | +# Define the order for deploying resources in Azure Resource Manager templates |
8 | 8 |
|
9 |
| -For a given resource, there can be other resources that must exist before the resource is deployed. For example, a SQL server must exist before attempting to deploy a SQL database. You define this relationship by marking one resource as dependent on the other resource. You define a dependency with the **dependsOn** element, or by using the **reference** function. |
| 9 | +When deploying a resource, you may need to make sure other resources exist before it's deployed. For example, you need a SQL server before deploying a SQL database. You define this relationship by marking one resource as dependent on the other resource. You define a dependency with the **dependsOn** element, or by using the **reference** function. |
10 | 10 |
|
11 |
| -Resource Manager evaluates the dependencies between resources, and deploys them in their dependent order. When resources aren't dependent on each other, Resource Manager deploys them in parallel. You only need to define dependencies for resources that are deployed in the same template. |
12 |
| - |
13 |
| -For a tutorial, see [Tutorial: create Azure Resource Manager templates with dependent resources](./resource-manager-tutorial-create-templates-with-dependent-resources.md). |
| 11 | +Resource Manager evaluates the dependencies between resources, and deploys them in their dependent order. When resources aren't dependent on each other, Resource Manager deploys them in parallel. You only need to define dependencies for resources that are deployed in the same template. |
14 | 12 |
|
15 | 13 | ## dependsOn
|
16 | 14 |
|
17 |
| -Within your template, the dependsOn element enables you to define one resource as a dependent on one or more resources. Its value can be a comma-separated list of resource names. |
| 15 | +Within your template, the dependsOn element enables you to define one resource as a dependent on one or more resources. Its value is a comma-separated list of resource names. The list can include resources that are [conditionally deployed](conditional-resource-deployment.md). When a conditional resource isn't deployed, Azure Resource Manager automatically removes it from the required dependencies. |
18 | 16 |
|
19 | 17 | The following example shows a virtual machine scale set that depends on a load balancer, virtual network, and a loop that creates multiple storage accounts. These other resources aren't shown in the following example, but they would need to exist elsewhere in the template.
|
20 | 18 |
|
@@ -45,12 +43,13 @@ When defining dependencies, you can include the resource provider namespace and
|
45 | 43 | "[resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName'))]",
|
46 | 44 | "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
47 | 45 | ]
|
48 |
| -``` |
| 46 | +``` |
49 | 47 |
|
50 |
| -While you may be inclined to use dependsOn to map relationships between your resources, it's important to understand why you're doing it. For example, to document how resources are interconnected, dependsOn isn't the right approach. You can't query which resources were defined in the dependsOn element after deployment. By using dependsOn, you potentially impact deployment time because Resource Manager doesn't deploy in parallel two resources that have a dependency. |
| 48 | +While you may be inclined to use dependsOn to map relationships between your resources, it's important to understand why you're doing it. For example, to document how resources are interconnected, dependsOn isn't the right approach. You can't query which resources were defined in the dependsOn element after deployment. By using dependsOn, you potentially impact deployment time because Resource Manager doesn't deploy in parallel two resources that have a dependency. |
51 | 49 |
|
52 | 50 | ## Child resources
|
53 |
| -The resources property allows you to specify child resources that are related to the resource being defined. Child resources can only be defined five levels deep. It's important to note that an implicit deployment dependency isn't created between a child resource and the parent resource. If you need the child resource to be deployed after the parent resource, you must explicitly state that dependency with the dependsOn property. |
| 51 | + |
| 52 | +The resources property allows you to specify child resources that are related to the resource being defined. Child resources can only be defined five levels deep. It's important to note that an implicit deployment dependency isn't created between a child resource and the parent resource. If you need the child resource to be deployed after the parent resource, you must explicitly state that dependency with the dependsOn property. |
54 | 53 |
|
55 | 54 | Each parent resource accepts only certain resource types as child resources. The accepted resource types are specified in the [template schema](https://github.com/Azure/azure-resource-manager-schemas) of the parent resource. The name of child resource type includes the name of the parent resource type, such as **Microsoft.Web/sites/config** and **Microsoft.Web/sites/extensions** are both child resources of the **Microsoft.Web/sites**.
|
56 | 55 |
|
@@ -95,6 +94,7 @@ The following example shows a SQL server and SQL database. Notice that an explic
|
95 | 94 | ```
|
96 | 95 |
|
97 | 96 | ## reference and list functions
|
| 97 | + |
98 | 98 | The [reference function](resource-group-template-functions-resource.md#reference) enables an expression to derive its value from other JSON name and value pairs or runtime resources. The [list* functions](resource-group-template-functions-resource.md#list) return values for a resource from a list operation. Reference and list expressions implicitly declare that one resource depends on another, when the referenced resource is deployed in the same template and referred to by its name (not resource ID). If you pass the resource ID into the reference or list functions, an implicit reference isn't created.
|
99 | 99 |
|
100 | 100 | The general format of the reference function is:
|
|
0 commit comments