Skip to content

Commit 45d00c6

Browse files
committed
add a languageVersion 2.0 section
1 parent 0b7b79b commit 45d00c6

File tree

9 files changed

+184
-49
lines changed

9 files changed

+184
-49
lines changed

articles/azure-resource-manager/bicep/loops.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ This Bicep file is transpiled into the following ARM JSON template that utilizes
378378
```json
379379
{
380380
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
381-
"languageVersion": "2.0",
381+
"languageVersion": "1.10-experimental",
382382
"contentVersion": "1.0.0.0",
383383
"parameters": {
384384
"location": {
@@ -419,7 +419,7 @@ This Bicep file is transpiled into the following ARM JSON template that utilizes
419419
}
420420
```
421421

422-
Note in the preceding ARM JSON template, `languageVersion` must be set to `2.0` or newer, and the resource element is an object instead of an array.
422+
Note in the preceding ARM JSON template, `languageVersion` must be set to `1.10-experimental`, and the resource element is an object instead of an array.
423423

424424
## Next steps
425425

articles/azure-resource-manager/templates/definitions.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ ms.date: 08/22/2023
88

99
# Type definitions in ARM templates
1010

11-
This article describes how to create and use definitions in your Azure Resource Manager template (ARM template). By defining your own types, you can reuse these types. Type definitions can only be used with [languageVersion 2.0](./syntax.md#template-format).
11+
This article describes how to create and use definitions in your Azure Resource Manager template (ARM template). By defining your own types, you can reuse these types. Type definitions can only be used with [languageVersion 2.0](./syntax.md#languageversion-20).
12+
13+
[!INCLUDE [VSCode ARM Tools extension doesn't support languageVersion 2.0](../../../includes/resource-manager-vscode-language-version-20.md)]
1214

1315
> [!TIP]
1416
> We recommend [Bicep](../bicep/overview.md) because it offers the same capabilities as ARM templates and the syntax is easier to use. To learn more, see [User-defined data types in Bicep](../bicep/user-defined-data-types.md).
1517
16-
1718
## Minimal declaration
1819

1920
At a minimum, every type definition needs a name and type.
@@ -366,7 +367,13 @@ You can add a description to a type definition to help users of your template un
366367

367368
## Use definition
368369

369-
To reference a type definition, use `"$ref": "#/definitions/<definition-name>"`. The following example shows how to reference a type definition from parameters and outputs.
370+
To reference a type definition, use the following syntax:
371+
372+
```json
373+
"$ref": "#/definitions/<definition-name>"
374+
```
375+
376+
The following example shows how to reference a type definition from parameters and outputs:
370377

371378
```json
372379
{

articles/azure-resource-manager/templates/parameters.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ Resource Manager resolves parameter values before starting the deployment operat
1414

1515
Each parameter must be set to one of the [data types](data-types.md).
1616

17-
> [!TIP]
18-
> We recommend [Bicep](../bicep/overview.md) because it offers the same capabilities as ARM templates and the syntax is easier to use. To learn more, see [parameters](../bicep/parameters.md).
19-
20-
You are limited to 256 parameters in a template. For more information, see [Template limits](./best-practices.md#template-limits).
21-
22-
For parameter best practices, see [Parameters](./best-practices.md#parameters).
23-
2417
In addition to minValue, maxValue, minLength, maxLength, and allowedValues, [languageVersion 2.0](./syntax.md#languageversion-20) introduces some aggregate type validation constraints to be used in [definitions](./syntax.md#definitions), [parameters](./syntax.md#parameters) and [outputs](./syntax.md#outputs) definitions. These constraints include:
2518

2619
- [additionalProperties](#additionalproperties)
@@ -30,6 +23,15 @@ In addition to minValue, maxValue, minLength, maxLength, and allowedValues, [lan
3023
- [prefixItems](#prefixitems)
3124
- [properties](#properties)
3225

26+
[!INCLUDE [VSCode ARM Tools extension doesn't support languageVersion 2.0](../../../includes/resource-manager-vscode-language-version-20.md)]
27+
28+
> [!TIP]
29+
> We recommend [Bicep](../bicep/overview.md) because it offers the same capabilities as ARM templates and the syntax is easier to use. To learn more, see [parameters](../bicep/parameters.md).
30+
31+
You are limited to 256 parameters in a template. For more information, see [Template limits](./best-practices.md#template-limits).
32+
33+
For parameter best practices, see [Parameters](./best-practices.md#parameters).
34+
3335
## Minimal declaration
3436

3537
At a minimum, every parameter needs a name and type.

articles/azure-resource-manager/templates/resource-declaration.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ ms.date: 09/28/2022
1010

1111
To deploy a resource through an Azure Resource Manager template (ARM template), you add a resource declaration. Use the `resources` array in a JSON template.
1212

13-
languageVersion 2.0 makes a list of enhancements to ARM JSON templates, such as use symbolic names for resources and change the resource definition from an array to an object. The majority of the samples shown in this article still use `resources` array. For languageVersion 2.0 specific information, see [Use symbolic name](#use-symbolic-name).
13+
[languageVersion 2.0](./syntax.md#languageversion-20) makes a list of enhancements to ARM JSON templates, such as use symbolic names for resources and change the resource definition from an array to an object. The majority of the samples shown in this article still use `resources` array. For languageVersion 2.0 specific information, see [Use symbolic name](#use-symbolic-name).
14+
15+
[!INCLUDE [VSCode ARM Tools extension doesn't support languageVersion 2.0](../../../includes/resource-manager-vscode-language-version-20.md)]
1416

1517
> [!TIP]
1618
> We recommend [Bicep](../bicep/overview.md) because it offers the same capabilities as ARM templates and the syntax is easier to use. To learn more, see [resource declaration](../bicep/resource-declaration.md).
@@ -207,7 +209,7 @@ If [Deployments resource](/azure/templates/microsoft.resources/deployments?tabs=
207209

208210
### Declare existing resources
209211

210-
With [`languageVersion 2.0`](#template-format) and using symbolic name for resource declaration, you can declare existing resources. A top-level resource property of `"existing": true` causes ARM to read rather than deploy a resource as shown in the following example:
212+
With [`languageVersion 2.0`](./syntax.md#languageversion-20) and using symbolic name for resource declaration, you can declare existing resources. A top-level resource property of `"existing": true` causes ARM to read rather than deploy a resource as shown in the following example:
211213

212214
```json
213215
{

articles/azure-resource-manager/templates/resource-dependency.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,44 @@ The following example shows a network interface that depends on a virtual networ
3535
}
3636
```
3737

38+
With [languageVersion 2.0](./syntax.md#languageversion-20), use resource symbolic name in `dependsOn` arrays. For example:
39+
40+
```json
41+
{
42+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
43+
"languageVersion": "2.0",
44+
"contentVersion": "1.0.0.0",
45+
"parameters": {
46+
"location": {
47+
"type": "string",
48+
"defaultValue": "[resourceGroup().location]"
49+
}
50+
},
51+
"resources": {
52+
"myStorage": {
53+
"type": "Microsoft.Storage/storageAccounts",
54+
"apiVersion": "2023-01-01",
55+
"name": "[format('storage{0}', uniqueString(resourceGroup().id))]",
56+
"location": "[parameters('location')]",
57+
"sku": {
58+
"name": "Standard_LRS"
59+
},
60+
"kind": "StorageV2"
61+
},
62+
"myVm": {
63+
"type": "Microsoft.Compute/virtualMachines",
64+
"apiVersion": "2023-03-01",
65+
"name": "[format('vm{0}', uniqueString(resourceGroup().id))]",
66+
"location": "[parameters('location')]",
67+
"dependsOn": [
68+
"myStorage"
69+
],
70+
...
71+
}
72+
}
73+
}
74+
```
75+
3876
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. After deployment, the resource doesn't retain deployment dependencies in its properties, so there are no commands or operations that let you see dependencies. Setting unnecessary dependencies slows deployment time because Resource Manager can't deploy those resources in parallel.
3977

4078
## Child resources
@@ -204,7 +242,7 @@ The following example shows how to deploy three storage accounts before deployin
204242
}
205243
```
206244

207-
[Symbolic names](./resource-declaration.md#use-symbolic-name) can be used in `dependsOn`` arrays. If a symbolic name is for a copy loop, all resources in the loop are added as dependencies. The preceding sample can be written as the following JSON. In the sample, **myVM** depends on all of the storage accounts in the **myStorages** loop.
245+
[Symbolic names](./resource-declaration.md#use-symbolic-name) can be used in `dependsOn` arrays. If a symbolic name is for a copy loop, all resources in the loop are added as dependencies. The preceding sample can be written as the following JSON. In the sample, **myVM** depends on all of the storage accounts in the **myStorages** loop.
208246

209247
```json
210248
{

0 commit comments

Comments
 (0)