Skip to content

Commit f178d5e

Browse files
committed
update
1 parent ad3d1e8 commit f178d5e

File tree

10 files changed

+109
-84
lines changed

10 files changed

+109
-84
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import * as <alias_name> from '<bicep_file_name>'
4343

4444
You can mix and match the preceding syntaxes. To access imported symbols using the wildcard syntax, you must use the `.` operator: `<alias_name>.<exported_symbol>`.
4545

46-
Only statements that have been [exported](#exporting-types-variables-and-functions) in the file being referenced are available to be imported.
46+
Only statements that have been [exported](#export-variables-types-and-functions) in the file being referenced are available to be imported.
4747

4848
Functionality that has been imported from another file can be used without restrictions. For example, imported variables can be used anywhere a variable declared in-file would normally be valid.
4949

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ The union type syntax can be used in [user-defined data types](./user-defined-da
385385

386386
## Secure strings and objects
387387

388-
Secure string uses the same format as string, and secure object uses the same format as object. With Bicep, you add the `@secure()` [decorator](./parameters.md#decorators) to a string or object.
388+
Secure string uses the same format as string, and secure object uses the same format as object. With Bicep, you add the `@secure()` [decorator](./parameters.md#use-decorators) to a string or object.
389389

390390
When you set a parameter to a secure string or secure object, the value of the parameter isn't saved to the deployment history and isn't logged. However, if you set that secure value to a property that isn't expecting a secure value, the value isn't protected. For example, if you set a secure string to a tag, that value is stored as plain text. Use secure strings for passwords and secrets.
391391

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

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,18 @@ You can add one or more decorators for each of the following element.
118118

119119
| Decorator | Apply to element | Apply to data type | Argument | Description |
120120
| --------- | ---- | ----------- | ------- |
121-
| [allowed](#allowed-values) | 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](#description) | parameter, variable | all | string | Text that explains how to use the parameter. The description is displayed to users through the portal. |
124-
| [discriminator](#property-name) | 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).|
125-
| [export]() | variable, type, function ||||
126-
| [maxLength](#length-constraints) | parameter | array, string | int | The maximum length for string and array parameters. The value is inclusive. |
127-
| [maxValue](#integer-constraints) | parameter | int | int | The maximum value for the integer parameter. This value is inclusive. |
128-
| [metadata](#metadata) | parameter | all | object | Custom properties to apply to the parameter. Can include a description property that is equivalent to the description decorator. |
129-
| [minLength](#length-constraints) | parameter | array, string | int | The minimum length for string and array parameters. The value is inclusive. |
130-
| [minValue](#integer-constraints) | parameter | int | int | The minimum value for the integer parameter. This value is inclusive. |
131-
| [sealed](#sealed) | parameter, type, output | 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 [](./user-defined-data-types.md#elevate-error-level). |
132-
| [secure](#secure-parameters) | parameter | string, object | none | Marks the parameter as secure. The value for a secure parameter isn't saved to the deployment history and isn't logged. For more information, see [Secure strings and objects](data-types.md#secure-strings-and-objects). |
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).|
125+
| export | variable, type, function ||||
126+
| maxLength | parameter | array, string | int | The maximum length for string and array parameters. The value is inclusive. |
127+
| maxValue | parameter | int | int | The maximum value for the integer parameter. This value is inclusive. |
128+
| metadata | parameter | all | object | Custom properties to apply to the parameter. Can include a description property that is equivalent to the description decorator. |
129+
| minLength | parameter | array, string | int | The minimum length for string and array parameters. The value is inclusive. |
130+
| minValue | parameter | int | int | The minimum value for the integer parameter. This value is inclusive. |
131+
| sealed | parameter, type, output | 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). |
132+
| secure | parameter | string, object | none | Marks the parameter as secure. The value for a secure parameter isn't saved to the deployment history and isn't logged. For more information, see [Secure strings and objects](data-types.md#secure-strings-and-objects). |
133133

134134
## Parameters
135135

@@ -149,7 +149,7 @@ sku: {
149149
}
150150
```
151151

152-
You can add one or more decorators for each parameter. For more information, see [Decorators](./parameters.md#use-decorators).
152+
You can add one or more decorators for each parameter. For more information, see [Use decorators](./parameters.md#use-decorators).
153153

154154
For more information, see [Parameters in Bicep](./parameters.md).
155155

@@ -168,7 +168,7 @@ resource stg 'Microsoft.Storage/storageAccounts@2023-04-01' = {
168168
name: uniqueStorageName
169169
```
170170

171-
You can add one or more decorators for each variable. For more information, see [Decorators](./variables.md#use-decorators).
171+
You can add one or more decorators for each variable. For more information, see [Use decorators](./variables.md#use-decorators).
172172

173173
For more information, see [Variables in Bicep](./variables.md).
174174

@@ -201,7 +201,7 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2023-04-01' = {
201201
}
202202
```
203203

204-
You can add one or more decorators for each user-defined data type. For more information, see [Decorators](./user-defined-data-types.md#use-decorators).
204+
You can add one or more decorators for each user-defined data type. For more information, see [Use decorators](./user-defined-data-types.md#use-decorators).
205205

206206
For more information, see [User-defined data types](./user-defined-data-types.md).
207207

@@ -215,8 +215,6 @@ func buildUrl(https bool, hostname string, path string) string => '${https ? 'ht
215215
output azureUrl string = buildUrl(true, 'microsoft.com', 'azure')
216216
```
217217

218-
You can add one or more decorators for each user-defined function. For more information, see [Decorators](./user-defined-functions.md#use-decorators).
219-
220218
For more information, see [User-defined functions](./user-defined-functions.md).
221219

222220
## Resources
@@ -239,7 +237,7 @@ resource stg 'Microsoft.Storage/storageAccounts@2023-04-01' = {
239237
}
240238
```
241239

242-
You can add one or more decorators for each resource. For more information, see [Decorators](./resource-declaration.md#use-decorators).
240+
You can add one or more decorators for each resource. For more information, see [Use decorators](./resource-declaration.md#use-decorators).
243241

244242
For more information, see [Resource declaration in Bicep](resource-declaration.md).
245243

@@ -307,7 +305,7 @@ module webModule './webApp.bicep' = {
307305

308306
The symbolic name enables you to reference the module from somewhere else in the file. For example, you can get an output value from a module by using the symbolic name and the name of the output value.
309307

310-
You can add one or more decorators for each module. For more information, see [Decorators](./modules.md#use-decorators).
308+
You can add one or more decorators for each module. For more information, see [Use decorators](./modules.md#use-decorators).
311309

312310
For more information, see [Use Bicep modules](./modules.md).
313311

@@ -319,7 +317,7 @@ Use outputs to return values from the deployment. Typically, you return a value
319317
output storageEndpoint object = stg.properties.primaryEndpoints
320318
```
321319

322-
You can add one or more decorators for each output. For more information, see [Decorators](./outputs.md#use-decorators).
320+
You can add one or more decorators for each output. For more information, see [Use decorators](./outputs.md#use-decorators).
323321

324322
For more information, see [Outputs in Bicep](./outputs.md).
325323

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,49 @@ module stgModule 'ts/ContosoSpecs:storageSpec:2.0' = {
268268
}
269269
```
270270

271+
## Use decorators
272+
273+
Decorators are written in the format `@expression` and are placed above module declarations. The following table shows the available decorators for modules.
274+
275+
| Decorator | Argument | Description |
276+
| --------- | ----------- | ------- |
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. |
279+
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.
281+
282+
### Description
283+
284+
To add explaination, add a description to module declarations. For example:
285+
286+
```bicep
287+
@description('Create storage accounts referencing an AVM.')
288+
module storage 'br/public:avm/res/storage/storage-account:0.9.0' = {
289+
name: 'myStorage'
290+
params: {
291+
name: 'store${resourceGroup().name}'
292+
}
293+
}
294+
```
295+
296+
### BatchSize
297+
298+
You can only apply `@batchSize()` to a resource or module definition that uses a [`for` expression](./loops.md).
299+
300+
By default, modules are deployed in parallel. When you add the `@batchSize(int)` decorator, you deploy instances serially.
301+
302+
```bicep
303+
@batchSize(3)
304+
module storage 'br/public:avm/res/storage/storage-account:0.11.1' = [for storageName in storageAccounts: {
305+
name: 'myStorage'
306+
params: {
307+
name: 'store${resourceGroup().name}'
308+
}
309+
}]
310+
```
311+
312+
For more information, see [Deploy in batches](loops.md#deploy-in-batches).
313+
271314
## Parameters
272315

273316
The parameters you provide in your module definition match the parameters in the Bicep file.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ output out 'a' | 'b' = foo
5656

5757
For more information, see [User-defined data types](./user-defined-data-types.md).
5858

59+
## Use decorators
60+
5961
## Conditional output
6062

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

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

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,31 +89,19 @@ However, you can't reference a [variable](./variables.md) as the default value.
8989

9090
## Use decorators
9191

92-
Parameters use decorators for constraints or metadata. The decorators are in the format `@expression` and are placed above the parameter's declaration. You can mark a parameter as secure, specify allowed values, set the minimum and maximum length for a string, set the minimum and maximum value for an integer, and provide a description of the parameter.
93-
94-
The following example shows two common uses for decorators.
95-
96-
```bicep
97-
@secure()
98-
param demoPassword string
99-
100-
@description('Must be at least Standard_A3 to support 2 NICs.')
101-
param virtualMachineSize string = 'Standard_DS1_v2'
102-
```
103-
104-
The following table describes the available decorators and how to use them.
92+
Parameters use decorators for constraints or metadata. The decorators are in the format `@expression` and are placed above the parameter's declaration. The following table shows the available decorators for parameters.
10593

10694
| Decorator | Apply to | Argument | Description |
10795
| --------- | ---- | ----------- | ------- |
10896
| [allowed](#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.|
10997
| [description](#description) | all | string | Text that explains how to use the parameter. The description is displayed to users through the portal. |
110-
| [discriminator](#property-name) | 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).|
98+
| [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).|
11199
| [maxLength](#length-constraints) | array, string | int | The maximum length for string and array parameters. The value is inclusive. |
112100
| [maxValue](#integer-constraints) | int | int | The maximum value for the integer parameter. This value is inclusive. |
113101
| [metadata](#metadata) | all | object | Custom properties to apply to the parameter. Can include a description property that is equivalent to the description decorator. |
114102
| [minLength](#length-constraints) | array, string | int | The minimum length for string and array parameters. The value is inclusive. |
115103
| [minValue](#integer-constraints) | int | int | The minimum value for the integer parameter. This value is inclusive. |
116-
| [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 [](./user-defined-data-types.md#elevate-error-level). |
104+
| [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). |
117105
| [secure](#secure-parameters) | string, object | none | Marks the parameter as secure. The value for a secure parameter isn't saved to the deployment history and isn't logged. For more information, see [Secure strings and objects](data-types.md#secure-strings-and-objects). |
118106

119107
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.
@@ -125,8 +113,6 @@ param name string
125113
param description string
126114
```
127115

128-
The available decorators are described in the following sections.
129-
130116
### Allowed values
131117

132118
You can define allowed values for a parameter. You provide the allowed values in an array. The deployment fails during validation if a value is passed in for the parameter that isn't one of the allowed values.
@@ -232,6 +218,8 @@ param demoPassword string
232218
param demoSecretObject object
233219
```
234220

221+
There are several linter rules related to this decorator: [Secure parameter default](./linter-rule-secure-parameter-default.md), [Secure parameters in nested deployments](./linter-rule-secure-params-in-nested-deploy.md), [Secure secrets in parameters](./linter-rule-secure-secrets-in-parameters.md).
222+
235223
## Use parameters
236224

237225
To reference the value for a parameter, use the parameter name. The following example uses a parameter value for a key vault name.

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

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,54 +60,42 @@ resource <symbolic-name> '<full-type-name>@<api-version>' = {
6060
}
6161
```
6262

63-
## Decorators
63+
## Use decorators
6464

65+
Decorators are written in the format `@expression` and are placed above resource declarations. The following table shows the available decorators for resources.
6566

67+
| Decorator | Argument | Description |
68+
| --------- | ----------- | ------- |
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. |
6671

67-
## Resource and module decorators
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.
6873

69-
You can add a decorator to a resource or module definition. The supported decorators are `batchSize(int)` and `description`. You can only apply it to a resource or module definition that uses a `for` expression.
74+
### Description
7075

71-
By default, resources are deployed in parallel. When you add the `batchSize(int)` decorator, you deploy instances serially.
76+
To add explaination, add a description to resource declarations. For example:
7277

7378
```bicep
74-
@batchSize(3)
79+
@description('Create a number of storage accounts')
7580
resource storageAccountResources 'Microsoft.Storage/storageAccounts@2023-04-01' = [for storageName in storageAccounts: {
7681
...
7782
}]
7883
```
7984

80-
For more information, see [Deploy in batches](loops.md#deploy-in-batches).
81-
82-
83-
84-
85-
85+
### BatchSize
8686

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

88-
89-
90-
91-
The following table describes the available decorators and how to use them.
92-
93-
| Decorator | Argument | Description |
94-
| --------- | ----------- | ------- |
95-
| [description](#description) | string | Text that explains how to use the variable.|
96-
| [batchSize](./bicep-import.md#export-variables-types-and-functions) | none | Indicates that the variable can be imported by another file. |
97-
98-
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.
99-
100-
You can add a decorator to a resource definition. The supported decorators are `@batchSize(int)` and `@description`.
89+
By default, resources are deployed in parallel. When you add the `batchSize(int)` decorator, you deploy instances serially.
10190

10291
```bicep
103-
@description('Create a number of storage accounts')
10492
@batchSize(3)
10593
resource storageAccountResources 'Microsoft.Storage/storageAccounts@2023-04-01' = [for storageName in storageAccounts: {
10694
...
10795
}]
10896
```
10997

110-
You can only apply the `@batchSize()` decorator to a resource or module definition that uses a `for` expression. For more information, see [Deploy in batches](loops.md#deploy-in-batches).
98+
For more information, see [Deploy in batches](loops.md#deploy-in-batches).
11199

112100
## Resource name
113101

0 commit comments

Comments
 (0)