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
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,29 +106,29 @@ 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 elements:
110
110
111
-
*Parameters
112
-
*Variables
113
-
*Resources
114
-
*Modules
115
-
*Ouputs
116
-
*Types
111
+
*[Parameter](#parameters)
112
+
*[Variable](#variables)
113
+
*[Resource](#resources)
114
+
*[Module](#modules)
115
+
*[Output](#outputs)
116
+
*[Type](#types)
117
117
118
118
| Decorator | Apply to element | Apply to data type | Argument | Description |
119
119
| --------- | ---- | ----------- | ------- |
120
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
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-defineddata 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).|
124
-
| export | variable, type, function||||
125
-
| maxLength | parameter| array, string | int | The maximum length for string and array parameters. The value is inclusive. |
126
-
| maxValue | parameter| int | int | The maximum value for the integer parameter. This value is inclusive. |
127
-
| metadata | parameter| all | object | Custom properties to apply to the parameter. Can include a description property that is equivalent to the description decorator. |
128
-
| minLength | parameter| array, string | int | The minimum length for string and array parameters. The value is inclusive. |
129
-
| minValue | parameter| int | int | The minimum value for the integer parameter. This value is inclusive. |
130
-
| 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). |
131
-
| 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). |
122
+
| description |[parameter](./parameters.md#description), [variable](./variables.md#description), [resource](./resource-declaration.md#description), [module](./modules.md#description), [output](./outputs.md#description), [type](./user-defined-data-types.md#description), [function](./user-defined-functions.md#description)| all | string | Text that explains how to use the element. |
123
+
| discriminator |[parameter](./parameters.md#discriminator, [type](./user-defined-data-types.md#discriminator), [output](./outputs.md#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).|
124
+
| export |[variable](./variables.md#export), [type](./user-defined-data-types.md#export), [function](./user-defined-functions.md#export)| all | none| Indicates that the element can be imported by another Bicep file. |
125
+
| maxLength |[parameter](./parameters.md#length-constraints), [output](./outputs.md#length-constraints)| array, string | int | The maximum length for string and array elemenets. The value is inclusive. |
126
+
| maxValue |[parameter](./parameters.md#integer-constraints), [output](./outputs.md#integer-constraints)| int | int | The maximum value for the integer elements. This value is inclusive. |
127
+
| metadata |[parameter](./parameters.md#metadata), [output](./outputs.md#metadata)| all | object | Custom properties to apply to the elements. Can include a description property that is equivalent to the description decorator. |
128
+
| minLength |[parameter](./parameters.md#length-constraints), [output](./outputs.md#length-constraints)| array, string | int | The minimum length for string and array elements. The value is inclusive. |
129
+
| minValue |[parameter](./parameters.md#integer-constraints), [output](./outputs.md#integer-constraints)| int | int | The minimum value for the integer elements. This value is inclusive. |
130
+
| sealed |[parameter](./parameters.md#sealed), [type](./user-defined-data-types.md#sealed), [output](./outputs.md#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). |
131
+
| secure |[parameter](./parameters.md#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). |
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/modules.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,11 +25,12 @@ Bicep modules are converted into a single Azure Resource Manager template with [
25
25
26
26
If you would rather learn about modules through step-by-step guidance, see [Create composable Bicep files by using modules](/training/modules/create-composable-bicep-files-using-modules/).
27
27
28
-
## Definition syntax
28
+
## Define modules
29
29
30
30
The basic syntax for defining a module is:
31
31
32
32
```bicep
33
+
@<decorator>(<argument>)
33
34
module <symbolic-name> '<path-to-file>' = {
34
35
name: '<linked-deployment-name>'
35
36
params: {
@@ -274,7 +275,7 @@ Decorators are written in the format `@expression` and are placed above module d
274
275
275
276
| Decorator | Argument | Description |
276
277
| --------- | ----------- | ------- |
277
-
|[description](#description)| string | Text that explains how to use the variable.|
278
+
|[description](#description)| string |Provide descriptions for the module.|
278
279
|[batchSize](./bicep-import.md#export-variables-types-and-functions)| none | Set up instances to deploy sequentially. |
279
280
280
281
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
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ ms.date: 08/20/2024
10
10
11
11
This article describes how to define output values in a Bicep file. You use outputs when you need to return values from the deployed resources. You are limited to 64 outputs in a Bicep file. For more information, see [Template limits](../templates/best-practices.md#template-limits).
12
12
13
-
## Define output values
13
+
## Define outputs
14
14
15
15
The syntax for defining an output value is:
16
16
@@ -62,7 +62,7 @@ Decorators are written in the format `@expression` and are placed above ouput de
62
62
63
63
| Decorator | Apply to | Argument | Description |
64
64
| --------- | ---- | ----------- | ------- |
65
-
|[description](#description)| all | string |Text that explains how to use the output. |
65
+
|[description](#description)| all | string |Provide descriptions for the output. |
66
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
67
|[maxLength](#length-constraints)| array, string | int | The maximum length for string and array outputs. The value is inclusive. |
68
68
|[maxValue](#integer-constraints)| int | int | The maximum value for the integer output. This value is inclusive. |
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/parameters.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,11 +22,12 @@ For parameter best practices, see [Parameters](./best-practices.md#parameters).
22
22
23
23
If you would rather learn about parameters through step-by-step guidance, see [Build reusable Bicep templates by using parameters](/training/modules/build-reusable-bicep-templates-parameters).
24
24
25
-
## Declare parameters
25
+
## Define parameters
26
26
27
27
Each parameter has a name and [data type](data-types.md). Optionally, you can provide a default value for the parameter.
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/resource-declaration.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ ms.date: 08/20/2024
10
10
11
11
This article describes the syntax you use to add a resource to your Bicep file. You are limited to 800 resources in a Bicep file. For more information, see [Template limits](../templates/best-practices.md#template-limits).
12
12
13
-
## Declaration
13
+
## Define resources
14
14
15
15
Add a resource declaration by using the `resource` keyword. You set a symbolic name for the resource. The symbolic name isn't the same as the resource name. You use the symbolic name to reference the resource in other parts of your Bicep file.
16
16
@@ -66,7 +66,7 @@ Decorators are written in the format `@expression` and are placed above resource
66
66
67
67
| Decorator | Argument | Description |
68
68
| --------- | ----------- | ------- |
69
-
|[description](#description)| string |Text that explains how to use the variable.|
69
+
|[description](#description)| string |Provide descriptions for the resource. |
70
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.
Many resources require a location. You can determine if the resource needs a location either through intellisense or [template reference](/azure/templates/). The following example adds a location parameter that is used for the storage account.
129
129
@@ -167,11 +167,11 @@ az provider show \
167
167
168
168
---
169
169
170
-
## Tags
170
+
## Resource tags
171
171
172
172
You can apply tags to a resource during deployment. Tags help you logically organize your deployed resources. For examples of the different ways you can specify the tags, see [ARM template tags](../management/tag-resources-bicep.md).
173
173
174
-
## Managed identities for Azure resources
174
+
## Managed identities for resources
175
175
176
176
Some resources support [managed identities for Azure resources](../../active-directory/managed-identities-azure-resources/overview.md). Those resources have an identity object at the root level of the resource declaration.
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/user-defined-data-types.md
+3-18Lines changed: 3 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,11 +12,12 @@ Learn how to create user-defined data types in Bicep. For system-defined data ty
12
12
13
13
[Bicep CLI version 0.12.X or higher](./install.md) is required to use this feature.
14
14
15
-
## Syntax
15
+
## Define types
16
16
17
17
You can use the `type` statement to create user-defined data types. In addition, you can also use type expressions in some places to define custom types.
18
18
19
19
```bicep
20
+
@<decorator>(<argument>)
20
21
type <user-defined-data-type-name> = <type-expression>
21
22
```
22
23
@@ -233,8 +234,8 @@ Decorators are written in the format `@expression` and are placed above the decl
233
234
234
235
| Decorator | Argument | Description |
235
236
| --------- | ----------- | ------- |
237
+
|[description](#description)| string | Provide descriptions for the user-defined data type. |
236
238
|[discriminator](#discriminator)| string | Use this decorator to ensure the correct subclass is identified and managed. |
237
-
|[description](#description)| string | Text that explains how to use the user-defined data type. |
238
239
|[export](#export)| none | Indicates that the user-defined data type can be imported by another file. |
239
240
|[sealed](#sealed)| 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](#elevate-error-level).|
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/user-defined-functions.md
+21-7Lines changed: 21 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,11 +21,12 @@ There are some restrictions when defining a user function:
21
21
* The function can't use the [reference](bicep-functions-resource.md#reference) function or any of the [list](bicep-functions-resource.md#list) functions.
22
22
* Parameters for the function can't have default values.
23
23
24
-
## Define the function
24
+
## Define functions
25
25
26
26
Use the `func` statement to define user-defined functions.
@@ -101,18 +102,31 @@ The output from the preceding example is:
101
102
| ---- | ---- | ----- |
102
103
| elements | positiveInt | 3 |
103
104
104
-
## Import functions between Bicep files
105
+
## Use decorators
105
106
106
-
Only functions that bear the `@export()` decorator can be imported to other templates.
107
+
Decorators are written in the format `@expression` and are placed above function declarations. The following table shows the available decorators for functions.
107
108
108
-
The following example enables you to import the user-defined function from other templates:
109
+
| Decorator | Argument | Description |
110
+
| --------- | ----------- | ------- |
111
+
|[description](#description)| string | Provide descriptions for the function. |
112
+
|[export](#export)| none | Indicates that the function can be imported by another file. |
113
+
114
+
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 variable named `description`, you must add the sys namespace when using the **description** decorator.
115
+
116
+
### Description
117
+
118
+
To add explaination, add a description to function declaration. For example:
For more information, see [Import variables, functions, and types](./bicep-import.md#import-types-variables-and-functions).
125
+
Markdown-formatted text can be used for the description text.
126
+
127
+
### Export
128
+
129
+
Use `@export()` to share the function 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
+2-14Lines changed: 2 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@ You are limited to 256 variables in a Bicep file. For more information, see [Tem
19
19
The syntax for defining a variable is:
20
20
21
21
```bicep
22
+
@<decorator>(<argument>)
22
23
var <variable-name> = <variable-value>
23
24
```
24
25
@@ -120,7 +121,7 @@ Decorators are written in the format `@expression` and are placed above variable
120
121
121
122
| Decorator | Argument | Description |
122
123
| --------- | ----------- | ------- |
123
-
|[description](#description)| string |Text that explains how to use the variable. |
124
+
|[description](#description)| string |Provide descriptions for the variable. |
124
125
|[export](#export)| none | Indicates that the variable can be imported by another file. |
125
126
126
127
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 variable named `description`, you must add the sys namespace when using the **description** decorator.
Because storage account names must use lowercase letters, the `storageName` variable uses the `toLower` function to make the `storageNamePrefix` value lowercase. The `uniqueString` function creates a unique value from the resource group ID. The values are concatenated to a string.
166
167
167
-
## Import variables between Bicep files
168
-
169
-
Only variables that bear the `@export()` decorator can be imported to other templates.
170
-
171
-
The following example enables you to import the variable from other templates:
172
-
173
-
```bicep
174
-
@export()
175
-
var myConstant = 'This is a constant value'
176
-
```
177
-
178
-
For more information, see [Import variables, types, and functions](./bicep-import.md#import-variables-types-and-functions).
179
-
180
168
## Configuration variables
181
169
182
170
You can define variables that hold related values for configuring an environment. You define the variable as an object with the values. The following example shows an object that holds values for two environments - **test** and **prod**. Pass in one of these values during deployment.
0 commit comments