You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/resource-manager-tutorial-create-linked-templates.md
+34-40Lines changed: 34 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Create linked templates
3
3
description: Learn how to create linked Azure Resource Manager templates for creating virtual machine
4
4
author: mumian
5
-
ms.date: 10/04/2019
5
+
ms.date: 12/03/2019
6
6
ms.topic: tutorial
7
7
ms.author: jgao
8
8
---
@@ -40,6 +40,7 @@ To complete this article, you need:
40
40
```azurecli-interactive
41
41
openssl rand -base64 32
42
42
```
43
+
43
44
Azure Key Vault is designed to safeguard cryptographic keys and other secrets. For more information, see [Tutorial: Integrate Azure Key Vault in Resource Manager Template deployment](./resource-manager-tutorial-use-key-vault.md). We also recommend you to update your password every three months.
44
45
45
46
## Open a Quickstart template
@@ -50,42 +51,46 @@ Azure QuickStart Templates is a repository for Resource Manager templates. Inste
50
51
* **The linked template**: create the storage account.
51
52
52
53
1. From Visual Studio Code, select **File**>**Open File**.
It is helpful to get some basic understanding of the template schema before customizing the template.
68
-
5. Select **File**>**Save As** to save a copy of the file to your local computer with the name **azuredeploy.json**.
69
-
6. Select **File**>**Save As** to create another copy of the file with the name **linkedTemplate.json**.
71
+
1. Select **File**>**Save As** to save a copy of the file to your local computer with the name **azuredeploy.json**.
72
+
1. Select **File**>**Save As** to create another copy of the file with the name **linkedTemplate.json**.
70
73
71
74
## Create the linked template
72
75
73
76
The linked template creates a storage account. The linked template can be used as a standalone template to create a storage account. In this tutorial, the linked template takes two parameters, and passes a value back to the main template. This "return" value is defined in the `outputs` element.
74
77
75
78
1. Open **linkedTemplate.json** in Visual Studio Code if the file is not opened.
76
-
2. Make the following changes:
79
+
1. Make the following changes:
77
80
78
81
* Remove all the parameters other than **location**.
79
82
* Add a parameter called **storageAccountName**.
80
-
```json
81
-
"storageAccountName":{
82
-
"type": "string",
83
-
"metadata": {
84
-
"description": "Azure Storage account name."
85
-
}
86
-
},
87
-
```
88
-
The storage account name and location are passed from the main template to the linked template as parameters.
83
+
84
+
```json
85
+
"storageAccountName":{
86
+
"type": "string",
87
+
"metadata": {
88
+
"description": "Azure Storage account name."
89
+
}
90
+
},
91
+
```
92
+
93
+
The storage account name and location are passed from the main template to the linked template as parameters.
89
94
90
95
* Remove the **variables** element, and all the variable definitions.
91
96
* Remove all the resources other than the storage account. You remove a total of four resources.
@@ -105,6 +110,7 @@ The linked template creates a storage account. The linked template can be used a
105
110
}
106
111
}
107
112
```
113
+
108
114
**storageUri** is required by the virtual machine resource definition in the main template. You pass the value back to the main template as an output value.
109
115
110
116
When you are done, the template shall look like:
@@ -133,7 +139,7 @@ The linked template creates a storage account. The linked template can be used a
133
139
"type": "Microsoft.Storage/storageAccounts",
134
140
"name": "[parameters('storageAccountName')]",
135
141
"location": "[parameters('location')]",
136
-
"apiVersion": "2018-07-01",
142
+
"apiVersion": "2018-11-01",
137
143
"sku": {
138
144
"name": "Standard_LRS"
139
145
},
@@ -149,7 +155,8 @@ The linked template creates a storage account. The linked template can be used a
@@ -263,8 +256,8 @@ The main template is called azuredeploy.json.
263
256
* You can only use [Incremental](./deployment-modes.md) deployment mode when calling linked templates.
264
257
* `templateLink/uri` contains the linked template URI. Update the value to the URI you get when you upload the linked template (the one with a SAS token).
265
258
* Use `parameters` to pass values from the main template to the linked template.
266
-
4. Make sure you have updated the value of the `uri` element to the value you got when you upload the linked template (the one with a SAS token). In practice, you want to supply the URI with a parameter.
267
-
5. Save the revised template
259
+
1. Make sure you have updated the value of the `uri` element to the value you got when you upload the linked template (the one with a SAS token). In practice, you want to supply the URI with a parameter.
260
+
1. Save the revised template
268
261
269
262
## Configure dependency
270
263
@@ -285,6 +278,7 @@ Because the storage account is defined in the linked template now, you must upda
285
278
}
286
279
}
287
280
```
281
+
288
282
This value is required by the main template.
289
283
290
284
1. Open azuredeploy.json in Visual Studio Code if it is not opened.
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/resource-manager-tutorial-create-templates-with-dependent-resources.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ When you explore the template in this section, try to answer these questions:
81
81

82
82
4. Expand the fourth resource. The resource type is `Microsoft.Network/networkInterfaces`:
83
83
84
-

84
+

85
85
86
86
The dependsOn element enables you to define one resource as a dependent on one or more resources. The resource depends on two other resources:
87
87
@@ -106,15 +106,15 @@ By specifying the dependencies, Resource Manager efficiently deploys the solutio
106
106
There are many methods for deploying templates. In this tutorial, you use Cloud Shell from the Azure portal.
107
107
108
108
1. Sign in to the [Cloud Shell](https://shell.azure.com).
109
-
2. Select **PowerShell** from the upper left corner of the Cloud shell, and then select **Confirm**. You use PowerShell in this tutorial.
110
-
3. Select **Upload file** from the Cloud shell:
109
+
1. Select **PowerShell** from the upper left corner of the Cloud shell, and then select **Confirm**. You use PowerShell in this tutorial.
4. Select the template you saved earlier in the tutorial. The default name is **azuredeploy.json**. If you have a file with the same file name, the old file is overwritten without any notification.
113
+
1. Select the template you saved earlier in the tutorial. The default name is **azuredeploy.json**. If you have a file with the same file name, the old file is overwritten without any notification.
114
114
115
115
You can optionally use the **ls $HOME** command and the **cat $HOME/azuredeploy.json** command to verify the files areis uploaded successfully.
116
116
117
-
5. From the Cloud shell, run the following PowerShell commands. To increase security, use a generated password for the virtual machine administrator account. See [Prerequisites](#prerequisites).
117
+
1. From the Cloud shell, run the following PowerShell commands. To increase security, use a generated password for the virtual machine administrator account. See [Prerequisites](#prerequisites).
118
118
119
119
```azurepowershell
120
120
$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name"
@@ -130,18 +130,20 @@ There are many methods for deploying templates. In this tutorial, you use Cloud
130
130
-adminPassword $adminPassword `
131
131
-dnsLabelPrefix $dnsLabelPrefix `
132
132
-TemplateFile "$HOME/azuredeploy.json"
133
+
Write-Host "Press [ENTER] to continue ..."
133
134
```
134
135
135
-
8. Run the following PowerShell command to list the newly created virtual machine:
136
+
1. Run the following PowerShell command to list the newly created virtual machine:
136
137
137
138
```azurepowershell
138
139
$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name"
0 commit comments