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/templates/best-practices.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -189,6 +189,23 @@ The following information can be helpful when you work with [resources](./syntax
189
189
]
190
190
```
191
191
192
+
If your ARM template is stored in a `.jsonc` file, comments using the `//` syntax are supported, as shown here.
193
+
194
+
```javascript
195
+
"resources": [
196
+
{
197
+
// This storage account is used to store the VM disks.
198
+
"name": "[variables('storageAccountName')]",
199
+
"type": "Microsoft.Storage/storageAccounts",
200
+
"apiVersion": "2019-06-01",
201
+
"location": "[resourceGroup().location]",
202
+
...
203
+
}
204
+
]
205
+
```
206
+
207
+
For more details about comments and metadata see [Understand the structure and syntax of ARM templates](/azure/azure-resource-manager/templates/syntax#comments-and-metadata).
208
+
192
209
* If you use a *public endpoint* in your template (such as an Azure Blob storage public endpoint), *don't hard-code* the namespace. Use the `reference` function to dynamically retrieve the namespace. You can use this approach to deploy the template to different public namespace environments without manually changing the endpoint in the template. Set the API version to the same version that you're using for the storage account in your template.
193
210
194
211
```json
@@ -272,6 +289,14 @@ The following information can be helpful when you work with [resources](./syntax
272
289
273
290
* Specify explicit values for properties that have default values that could change over time. For example, if you're deploying an AKS cluster, you can either specify or omit the `kubernetesVersion` property. If you don't specify it, then [the cluster is defaulted to the N-1 minor version and latest patch](../../aks/supported-kubernetes-versions.md#azure-portal-and-cli-versions). When you deploy the cluster using an ARM template, this default behavior might not be what you expect. Redeploying your template may result in the cluster being upgraded to a new Kubernetes version unexpectedly. Instead, consider specifying an explicit version number and then manually changing it when you're ready to upgrade your cluster.
274
291
292
+
## Comments
293
+
294
+
In addition to the `comments` property, comments using the `//` syntax are supported. For more details about comments and metadata see [Understand the structure and syntax of ARM templates](/azure/azure-resource-manager/templates/syntax#comments-and-metadata). You may choose to save JSON files that contain `//` comments using the `.jsonc` file extension, to indicate the JSON file contains comments. The ARM service will also accept comments in any JSON file including parameters files.
295
+
296
+
## Visual Studio Code ARM Tools
297
+
298
+
Working with ARM templates is much easier with the Azure Resource Manager (ARM) Tools for Visual Studio Code. This extension provides language support, resource snippets, and resource auto-completion to help you create and validate Azure Resource Manager templates. To learn more and install the extension, see [Azure Resource Manager (ARM) Tools](https://marketplace.visualstudio.com/items?itemName=msazurermtools.azurerm-vscode-tools).
299
+
275
300
## Use test toolkit
276
301
277
302
The ARM template test toolkit is a script that checks whether your template uses recommended practices. When your template isn't compliant with recommended practices, it returns a list of warnings with suggested changes. The test toolkit can help you learn how to implement best practices in your template.
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/templates/deploy-cli.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,8 @@ az deployment group create \
79
79
--parameters storageAccountType=Standard_GRS
80
80
```
81
81
82
+
The value of the `--template-file` parameter must be a Bicep file or a `.json` or `.jsonc` file. The `.jsonc` file extension indicates the file can contain `//` style comments. The ARM system accepts `//` comments in `.json` files. It does not care about the file extension. For more details about comments and metadata see [Understand the structure and syntax of ARM templates](/azure/azure-resource-manager/templates/syntax#comments-and-metadata).
83
+
82
84
The Azure deployment template can take a few minutes to complete. When it finishes, you see a message that includes the result:
83
85
84
86
```output
@@ -268,9 +270,20 @@ az deployment group create \
268
270
--parameters '@storage.parameters.json'
269
271
```
270
272
271
-
## Handle extended JSON format
273
+
## Comments and the extended JSON format
274
+
275
+
You can include `//` style comments in your parameter file, but you must name the file with a `.jsonc` extension.
276
+
277
+
```azurecli-interactive
278
+
az deployment group create \
279
+
--name ExampleDeployment \
280
+
--resource-group ExampleGroup \
281
+
--template-file storage.json \
282
+
--parameters '@storage.parameters.jsonc'
283
+
```
284
+
For more details about comments and metadata see [Understand the structure and syntax of ARM templates](/azure/azure-resource-manager/templates/syntax#comments-and-metadata).
272
285
273
-
To deploy a template with multi-line strings or comments using Azure CLI with version 2.3.0 or older, you must use the `--handle-extended-json-format` switch. For example:
286
+
If you are using Azure CLI with version 2.3.0 or older, you can deploy a template with multi-line strings or comments using the `--handle-extended-json-format` switch. For example:
0 commit comments