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/bicep/file.md
+6-7Lines changed: 6 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Bicep file structure and syntax
3
3
description: Describes the structure and properties of a Bicep file using declarative syntax.
4
4
ms.topic: conceptual
5
5
ms.custom: devx-track-bicep
6
-
ms.date: 08/19/2024
6
+
ms.date: 08/20/2024
7
7
---
8
8
9
9
# Understand the structure and syntax of Bicep files
@@ -106,22 +106,21 @@ In a module, you can specify a scope that is different than the scope for the re
106
106
107
107
## Decorator
108
108
109
-
You can add one or more decorators for each of the following element.
109
+
You can add one or more decorators for each of the following element:
110
110
111
111
* Parameters
112
112
* Variables
113
113
* Resources
114
114
* Modules
115
115
* Ouputs
116
116
* Types
117
-
* Functions
118
117
119
118
| Decorator | Apply to element | Apply to data type | Argument | Description |
120
119
| --------- | ---- | ----------- | ------- |
121
-
| allowed | parameter | all | array | Use this decorator to make sure the user provides correct values. This decorator is only permitted on `param` statements. To declare that a property must be one of a set of predefined values in a [`type`](./user-defined-data-types.md) or [`output`](./outputs.md) statement, use [union type syntax](./data-types.md#union-types). Union type syntax can also be used in `param` statements.|
122
-
|batch |resource, module||||
123
-
| description | parameter, variable| all | string | Text that explains how to use the parameter. The description is displayed to users through the portal. |
124
-
| discriminator |parameters| object | string | Use this decorator to ensure the correct subclass is identified and managed. For more information, see [Custom-tagged union data type](./data-types.md#custom-tagged-union-data-type).|
120
+
| allowed |[parameter](./parameters.md#allowed-values)| all | array | Use this decorator to make sure the user provides correct values. This decorator is only permitted on `param` statements. To declare that a property must be one of a set of predefined values in a [`type`](./user-defined-data-types.md) or [`output`](./outputs.md) statement, use [union type syntax](./data-types.md#union-types). Union type syntax can also be used in `param` statements.|
121
+
|batchSize |[resource](./resource-declaration.md#batchsize), [module](./modules.md#batchsize)| N/A | integer | Set up instances to deploy sequentially. |
122
+
| description |[parameter](./parameters.md#description), [variable](./variables.md#description), [resource](./resource-declaration.md#description), [module](./modules.md#description), [output](./outputs.md#description), [user-defined data type](./user-defined-data-types.md#description)| all | string | Text that explains how to use the element. |
123
+
| discriminator |parameter| object | string | Use this decorator to ensure the correct subclass is identified and managed. For more information, see [Custom-tagged union data type](./data-types.md#custom-tagged-union-data-type).|
125
124
| export | variable, type, function ||||
126
125
| maxLength | parameter | array, string | int | The maximum length for string and array parameters. The value is inclusive. |
127
126
| maxValue | parameter | int | int | The maximum value for the integer parameter. This value is inclusive. |
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/modules.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Bicep modules
3
3
description: Describes how to define a module in a Bicep file, and how to use module scopes.
4
4
ms.topic: conceptual
5
5
ms.custom: devx-track-bicep
6
-
ms.date: 06/28/2024
6
+
ms.date: 08/20/2024
7
7
---
8
8
9
9
# Bicep modules
@@ -275,7 +275,7 @@ Decorators are written in the format `@expression` and are placed above module d
275
275
| Decorator | Argument | Description |
276
276
| --------- | ----------- | ------- |
277
277
|[description](#description)| string | Text that explains how to use the variable.|
278
-
|[batchSize](./bicep-import.md#export-variables-types-and-functions)| none |Indicates that the variable can be imported by another file. |
278
+
|[batchSize](./bicep-import.md#export-variables-types-and-functions)| none |Set up instances to deploy sequentially. |
279
279
280
280
Decorators are in the [sys namespace](bicep-functions.md#namespaces-for-functions). If you need to differentiate a decorator from another item with the same name, preface the decorator with `sys`. For example, if your Bicep file includes a parameter named `description`, you must add the sys namespace when using the **description** decorator.
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/outputs.md
+95-1Lines changed: 95 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Outputs in Bicep
3
3
description: Describes how to define output values in Bicep
4
4
ms.topic: conceptual
5
5
ms.custom: devx-track-bicep
6
-
ms.date: 12/06/2023
6
+
ms.date: 08/20/2024
7
7
---
8
8
9
9
# Outputs in Bicep
@@ -58,6 +58,100 @@ For more information, see [User-defined data types](./user-defined-data-types.md
58
58
59
59
## Use decorators
60
60
61
+
Decorators are written in the format `@expression` and are placed above ouput declarations. The following table shows the available decorators for outputs.
62
+
63
+
| Decorator | Apply to | Argument | Description |
64
+
| --------- | ---- | ----------- | ------- |
65
+
|[description](#description)| all | string | Text that explains how to use the output. |
66
+
|[discriminator](#discriminator)| object | string | Use this decorator to ensure the correct subclass is identified and managed. For more information, see [Custom-tagged union data type](./data-types.md#custom-tagged-union-data-type).|
67
+
|[maxLength](#length-constraints)| array, string | int | The maximum length for string and array outputs. The value is inclusive. |
68
+
|[maxValue](#integer-constraints)| int | int | The maximum value for the integer output. This value is inclusive. |
69
+
|[metadata](#metadata)| all | object | Custom properties to apply to the output. Can include a description property that is equivalent to the description decorator. |
70
+
|[minLength](#length-constraints)| array, string | int | The minimum length for string and array outputs. The value is inclusive. |
71
+
|[minValue](#integer-constraints)| int | int | The minimum value for the integer output. This value is inclusive. |
72
+
|[sealed](#sealed)| object | none | Elevate [BCP089](./diagnostics/bcp089.md) from a warning to an error when a property name of a use-define data type is likely a typo. For more information, see [Elevate error level](./user-defined-data-types.md#elevate-error-level). |
73
+
74
+
Decorators are in the [sys namespace](bicep-functions.md#namespaces-for-functions). If you need to differentiate a decorator from another item with the same name, preface the decorator with `sys`. For example, if your Bicep file includes a parameter named `description`, you must add the sys namespace when using the **description** decorator.
75
+
76
+
```bicep
77
+
@sys.description('The name of the instance.')
78
+
param name string
79
+
@sys.description('The description of the instance to display.')
80
+
param description string
81
+
```
82
+
83
+
### Description
84
+
85
+
To add explaination, add a description to output declarations. For example:
86
+
87
+
```bicep
88
+
@description('Conditionally output the endpoint.')
Markdown-formatted text can be used for the description text.
93
+
94
+
### Discriminator
95
+
96
+
See [Custom-tagged union data type](./data-types.md#custom-tagged-union-data-type).
97
+
98
+
### Integer constraints
99
+
100
+
You can set minimum and maximum values for integer outputs. You can set one or both constraints.
101
+
102
+
```bicep
103
+
var thisMonth = 3
104
+
105
+
@minValue(1)
106
+
@maxValue(12)
107
+
output month int = thisMonth
108
+
```
109
+
110
+
### Length constraints
111
+
112
+
You can specify minimum and maximum lengths for string and array outputs. You can set one or both constraints. For strings, the length indicates the number of characters. For arrays, the length indicates the number of items in the array.
113
+
114
+
The following example declares two outputs. One output is for a storage account name that must have 3-24 characters. The other output is an array that must have from 1-5 items.
115
+
116
+
```bicep
117
+
var accountName = uniqueString(resourceGroup().id)
118
+
var appNames = [
119
+
'SyncSphere'
120
+
'DataWhiz'
121
+
'FlowMatrix'
122
+
]
123
+
124
+
@minLength(3)
125
+
@maxLength(24)
126
+
output storageAccountName string = accountName
127
+
128
+
@minLength(1)
129
+
@maxLength(5)
130
+
output applicationNames array = appNames
131
+
```
132
+
133
+
### Metadata
134
+
135
+
If you have custom properties that you want to apply to an output, add a metadata decorator. Within the metadata, define an object with the custom names and values. The object you define for the metadata can contain properties of any name and type.
136
+
137
+
You might use this decorator to track information about the output that doesn't make sense to add to the [description](#description).
138
+
139
+
```bicep
140
+
var obj = {}
141
+
@description('Configuration values that are applied when the application starts.')
142
+
@metadata({
143
+
source: 'database'
144
+
contact: 'Web team'
145
+
})
146
+
output settings object = obj
147
+
```
148
+
149
+
When you provide a `@metadata()` decorator with a property that conflicts with another decorator, that decorator always takes precedence over anything in the `@metadata()` decorator. So, the conflicting property within the `@metadata()` value is redundant and will be replaced. For more information, see [No conflicting metadata](./linter-rule-no-conflicting-metadata.md).
150
+
151
+
### Sealed
152
+
153
+
See [Elevate error level](./user-defined-data-types.md#elevate-error-level).
154
+
61
155
## Conditional output
62
156
63
157
When the value to return depends on a condition in the deployment, use the `?` operator.
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/resource-declaration.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Declare resources in Bicep
3
3
description: Describes how to declare resources to deploy in Bicep.
4
4
ms.topic: conceptual
5
5
ms.custom: devx-track-bicep
6
-
ms.date: 08/16/2024
6
+
ms.date: 08/20/2024
7
7
---
8
8
9
9
# Resource declaration in Bicep
@@ -67,7 +67,7 @@ Decorators are written in the format `@expression` and are placed above resource
67
67
| Decorator | Argument | Description |
68
68
| --------- | ----------- | ------- |
69
69
|[description](#description)| string | Text that explains how to use the variable.|
70
-
|[batchSize](./bicep-import.md#export-variables-types-and-functions)| none |Indicates that the variable can be imported by another file. |
70
+
|[batchSize](./bicep-import.md#export-variables-types-and-functions)| none |Set up instances to deploy sequentially. |
71
71
72
72
Decorators are in the [sys namespace](bicep-functions.md#namespaces-for-functions). If you need to differentiate a decorator from another item with the same name, preface the decorator with `sys`. For example, if your Bicep file includes a parameter named `description`, you must add the sys namespace when using the **description** decorator.
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/user-defined-data-types.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: User-defined types in Bicep
3
3
description: Describes how to define and use user-defined data types in Bicep.
4
4
ms.topic: conceptual
5
5
ms.custom: devx-track-bicep
6
-
ms.date: 08/16/2024
6
+
ms.date: 08/20/2024
7
7
---
8
8
9
9
# User-defined data types in Bicep
@@ -259,6 +259,9 @@ type obj = {
259
259
}
260
260
```
261
261
262
+
Markdown-formatted text can be used for the description text.
263
+
264
+
262
265
### Export
263
266
264
267
Use `@export()` to share the user-define data type with other Bicep files. For more information, see [Export variables, types, and functions](./bicep-import.md#export-variables-types-and-functions).
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/variables.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Variables in Bicep
3
3
description: Describes how to define variables in Bicep
4
4
ms.topic: conceptual
5
5
ms.custom: devx-track-bicep
6
-
ms.date: 03/20/2024
6
+
ms.date: 08/20/2024
7
7
---
8
8
9
9
# Variables in Bicep
@@ -134,6 +134,8 @@ To add explaination, add a description to variable declaration. For example:
134
134
var storageAccountName = uniqueString(resourceGroup().id)
135
135
```
136
136
137
+
Markdown-formatted text can be used for the description text.
138
+
137
139
### Export
138
140
139
141
Use `@export()` to share the variable with other Bicep files. For more information, see [Export variables, types, and functions](./bicep-import.md#export-variables-types-and-functions).
@@ -173,7 +175,7 @@ The following example enables you to import the variable from other templates:
173
175
var myConstant = 'This is a constant value'
174
176
```
175
177
176
-
For more information, see [Import variables, types, and functions](./bicep-import.md#import-types-variables-and-functions).
178
+
For more information, see [Import variables, types, and functions](./bicep-import.md#import-variables-types-and-functions).
0 commit comments