|
1 | 1 | ---
|
2 | 2 | title: Create and deploy template spec
|
3 | 3 | description: Learn how to create a template spec from ARM template. Then, deploy the template spec to a resource group in your subscription.
|
4 |
| -ms.date: 01/29/2025 |
| 4 | +ms.date: 07/24/2025 |
5 | 5 | ms.topic: quickstart
|
6 | 6 | ms.custom: mode-api, devx-track-azurecli, devx-track-arm-template
|
7 | 7 | ms.devlang: azurecli
|
@@ -118,82 +118,76 @@ The template spec is a resource type named `Microsoft.Resources/templateSpecs`.
|
118 | 118 | {
|
119 | 119 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
120 | 120 | "contentVersion": "1.0.0.0",
|
121 |
| - "parameters": {}, |
122 |
| - "functions": [], |
123 |
| - "variables": {}, |
124 | 121 | "resources": [
|
125 | 122 | {
|
126 | 123 | "type": "Microsoft.Resources/templateSpecs",
|
127 |
| - "apiVersion": "2021-05-01", |
| 124 | + "apiVersion": "2022-02-01", |
128 | 125 | "name": "storageSpec",
|
129 | 126 | "location": "westus2",
|
130 | 127 | "properties": {
|
131 | 128 | "displayName": "Storage template spec"
|
132 |
| - }, |
133 |
| - "tags": {}, |
134 |
| - "resources": [ |
135 |
| - { |
136 |
| - "type": "versions", |
137 |
| - "apiVersion": "2021-05-01", |
138 |
| - "name": "1.0", |
139 |
| - "location": "westus2", |
140 |
| - "dependsOn": [ "storageSpec" ], |
141 |
| - "properties": { |
142 |
| - "mainTemplate": { |
143 |
| - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", |
144 |
| - "contentVersion": "1.0.0.0", |
145 |
| - "parameters": { |
146 |
| - "storageAccountType": { |
147 |
| - "type": "string", |
148 |
| - "defaultValue": "Standard_LRS", |
149 |
| - "allowedValues": [ |
150 |
| - "Standard_LRS", |
151 |
| - "Standard_GRS", |
152 |
| - "Standard_ZRS", |
153 |
| - "Premium_LRS" |
154 |
| - ], |
155 |
| - "metadata": { |
156 |
| - "description": "Storage Account type" |
157 |
| - } |
158 |
| - }, |
159 |
| - "location": { |
160 |
| - "type": "string", |
161 |
| - "defaultValue": "[[resourceGroup().location]", |
162 |
| - "metadata": { |
163 |
| - "description": "Location for all resources." |
164 |
| - } |
165 |
| - } |
166 |
| - }, |
167 |
| - "variables": { |
168 |
| - "storageAccountName": "[[concat('store', uniquestring(resourceGroup().id))]" |
169 |
| - }, |
170 |
| - "resources": [ |
171 |
| - { |
172 |
| - "type": "Microsoft.Storage/storageAccounts", |
173 |
| - "apiVersion": "2022-09-01", |
174 |
| - "name": "[[variables('storageAccountName')]", |
175 |
| - "location": "[[parameters('location')]", |
176 |
| - "sku": { |
177 |
| - "name": "[[parameters('storageAccountType')]" |
178 |
| - }, |
179 |
| - "kind": "StorageV2", |
180 |
| - "properties": {} |
181 |
| - } |
| 129 | + } |
| 130 | + }, |
| 131 | + { |
| 132 | + "type": "Microsoft.Resources/templateSpecs/versions", |
| 133 | + "apiVersion": "2022-02-01", |
| 134 | + "name": "[format('{0}/{1}', 'storageSpec', '1.0')]", |
| 135 | + "location": "westus2", |
| 136 | + "properties": { |
| 137 | + "mainTemplate": { |
| 138 | + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", |
| 139 | + "contentVersion": "1.0.0.0", |
| 140 | + "parameters": { |
| 141 | + "storageAccountType": { |
| 142 | + "type": "string", |
| 143 | + "defaultValue": "Standard_LRS", |
| 144 | + "allowedValues": [ |
| 145 | + "Standard_LRS", |
| 146 | + "Standard_GRS", |
| 147 | + "Standard_ZRS", |
| 148 | + "Premium_LRS" |
182 | 149 | ],
|
183 |
| - "outputs": { |
184 |
| - "storageAccountName": { |
185 |
| - "type": "string", |
186 |
| - "value": "[[variables('storageAccountName')]" |
187 |
| - } |
| 150 | + "metadata": { |
| 151 | + "description": "Storage Account type" |
| 152 | + } |
| 153 | + }, |
| 154 | + "location": { |
| 155 | + "type": "string", |
| 156 | + "defaultValue": "[[resourceGroup().location]", |
| 157 | + "metadata": { |
| 158 | + "description": "Location for all resources." |
188 | 159 | }
|
189 | 160 | }
|
190 | 161 | },
|
191 |
| - "tags": {} |
| 162 | + "variables": { |
| 163 | + "storageAccountName": "[[concat('store', uniquestring(resourceGroup().id))]" |
| 164 | + }, |
| 165 | + "resources": [ |
| 166 | + { |
| 167 | + "type": "Microsoft.Storage/storageAccounts", |
| 168 | + "apiVersion": "2022-09-01", |
| 169 | + "name": "[[variables('storageAccountName')]", |
| 170 | + "location": "[[parameters('location')]", |
| 171 | + "sku": { |
| 172 | + "name": "[[parameters('storageAccountType')]" |
| 173 | + }, |
| 174 | + "kind": "StorageV2", |
| 175 | + "properties": {} |
| 176 | + } |
| 177 | + ], |
| 178 | + "outputs": { |
| 179 | + "storageAccountName": { |
| 180 | + "type": "string", |
| 181 | + "value": "[[variables('storageAccountName')]" |
| 182 | + } |
| 183 | + } |
192 | 184 | }
|
| 185 | + }, |
| 186 | + "dependsOn": [ |
| 187 | + "storageSpec" |
193 | 188 | ]
|
194 | 189 | }
|
195 |
| - ], |
196 |
| - "outputs": {} |
| 190 | + ] |
197 | 191 | }
|
198 | 192 | ```
|
199 | 193 |
|
@@ -333,7 +327,7 @@ To deploy a template spec, use the same deployment commands as you would use to
|
333 | 327 | "resources": [
|
334 | 328 | {
|
335 | 329 | "type": "Microsoft.Resources/deployments",
|
336 |
| - "apiVersion": "2021-04-01", |
| 330 | + "apiVersion": "2025-04-01", |
337 | 331 | "name": "demo",
|
338 | 332 | "properties": {
|
339 | 333 | "templateLink": {
|
|
0 commit comments