Skip to content

Commit fd855d1

Browse files
committed
update
1 parent f178d5e commit fd855d1

File tree

9 files changed

+120
-18
lines changed

9 files changed

+120
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Imports in Bicep
33
description: Describes how to import shared functionality and namespaces in Bicep.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 08/16/2024
6+
ms.date: 08/20/2024
77
---
88

99
# Imports in Bicep

articles/azure-resource-manager/bicep/data-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Data types in Bicep
33
description: Describes the data types that are available in Bicep
44
ms.topic: reference
55
ms.custom: devx-track-bicep
6-
ms.date: 07/16/2024
6+
ms.date: 08/20/2024
77
---
88

99
# Data types in Bicep

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Bicep file structure and syntax
33
description: Describes the structure and properties of a Bicep file using declarative syntax.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 08/19/2024
6+
ms.date: 08/20/2024
77
---
88

99
# 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
106106

107107
## Decorator
108108

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:
110110

111111
* Parameters
112112
* Variables
113113
* Resources
114114
* Modules
115115
* Ouputs
116116
* Types
117-
* Functions
118117

119118
| Decorator | Apply to element | Apply to data type | Argument | Description |
120119
| --------- | ---- | ----------- | ------- |
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).|
125124
| export | variable, type, function ||||
126125
| maxLength | parameter | array, string | int | The maximum length for string and array parameters. The value is inclusive. |
127126
| maxValue | parameter | int | int | The maximum value for the integer parameter. This value is inclusive. |

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Bicep modules
33
description: Describes how to define a module in a Bicep file, and how to use module scopes.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 06/28/2024
6+
ms.date: 08/20/2024
77
---
88

99
# Bicep modules
@@ -275,7 +275,7 @@ Decorators are written in the format `@expression` and are placed above module d
275275
| Decorator | Argument | Description |
276276
| --------- | ----------- | ------- |
277277
| [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. |
279279

280280
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.
281281

@@ -293,6 +293,8 @@ module storage 'br/public:avm/res/storage/storage-account:0.9.0' = {
293293
}
294294
```
295295

296+
Markdown-formatted text can be used for the description text.
297+
296298
### BatchSize
297299

298300
You can only apply `@batchSize()` to a resource or module definition that uses a [`for` expression](./loops.md).

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

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Outputs in Bicep
33
description: Describes how to define output values in Bicep
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 12/06/2023
6+
ms.date: 08/20/2024
77
---
88

99
# Outputs in Bicep
@@ -58,6 +58,100 @@ For more information, see [User-defined data types](./user-defined-data-types.md
5858

5959
## Use decorators
6060

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.')
89+
output endpoint string = deployStorage ? myStorageAccount.properties.primaryEndpoints.blob : ''
90+
```
91+
92+
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+
61155
## Conditional output
62156

63157
When the value to return depends on a condition in the deployment, use the `?` operator.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Parameters in Bicep files
33
description: Describes how to define parameters in a Bicep file.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 08/16/2024
6+
ms.date: 08/20/2024
77
---
88

99
# Parameters in Bicep

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Declare resources in Bicep
33
description: Describes how to declare resources to deploy in Bicep.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 08/16/2024
6+
ms.date: 08/20/2024
77
---
88

99
# Resource declaration in Bicep
@@ -67,7 +67,7 @@ Decorators are written in the format `@expression` and are placed above resource
6767
| Decorator | Argument | Description |
6868
| --------- | ----------- | ------- |
6969
| [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. |
7171

7272
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.
7373

@@ -82,6 +82,8 @@ resource storageAccountResources 'Microsoft.Storage/storageAccounts@2023-04-01'
8282
}]
8383
```
8484

85+
Markdown-formatted text can be used for the description text.
86+
8587
### BatchSize
8688

8789
You can only apply `@batchSize()` to a resource or module definition that uses a [`for` expression](./loops.md).

articles/azure-resource-manager/bicep/user-defined-data-types.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: User-defined types in Bicep
33
description: Describes how to define and use user-defined data types in Bicep.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 08/16/2024
6+
ms.date: 08/20/2024
77
---
88

99
# User-defined data types in Bicep
@@ -259,6 +259,9 @@ type obj = {
259259
}
260260
```
261261

262+
Markdown-formatted text can be used for the description text.
263+
264+
262265
### Export
263266

264267
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).

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Variables in Bicep
33
description: Describes how to define variables in Bicep
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 03/20/2024
6+
ms.date: 08/20/2024
77
---
88

99
# Variables in Bicep
@@ -134,6 +134,8 @@ To add explaination, add a description to variable declaration. For example:
134134
var storageAccountName = uniqueString(resourceGroup().id)
135135
```
136136

137+
Markdown-formatted text can be used for the description text.
138+
137139
### Export
138140

139141
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:
173175
var myConstant = 'This is a constant value'
174176
```
175177

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).
177179

178180
## Configuration variables
179181

0 commit comments

Comments
 (0)