Skip to content

Commit 638c03a

Browse files
committed
modified: articles/azure-resource-manager/templates/best-practices.md modified: articles/azure-resource-manager/templates/deploy-cli.md Signed-off-by: Ed Burns <[email protected]>
1 parent 51a48dc commit 638c03a

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

articles/azure-resource-manager/templates/best-practices.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,21 @@ The following information can be helpful when you work with [resources](./syntax
189189
]
190190
```
191191

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+
192207
* 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.
193208

194209
```json
@@ -272,6 +287,10 @@ The following information can be helpful when you work with [resources](./syntax
272287

273288
* 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.
274289

290+
## Comments
291+
292+
In addition to the `comments` property, if your ARM template is stored in a `.jsonc` file, comments using the `//` syntax are supported.
293+
275294
## Use test toolkit
276295

277296
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.

articles/azure-resource-manager/templates/deploy-cli.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ az deployment group create \
7979
--parameters storageAccountType=Standard_GRS
8080
```
8181

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.
83+
8284
The Azure deployment template can take a few minutes to complete. When it finishes, you see a message that includes the result:
8385

8486
```output
@@ -268,9 +270,19 @@ az deployment group create \
268270
--parameters '@storage.parameters.json'
269271
```
270272

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+
```
272284

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:
285+
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:
274286

275287
```json
276288
{

0 commit comments

Comments
 (0)