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/bicep-core-diagnostics.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,15 @@ ms.custom:
7
7
- devx-track-bicep
8
8
- devx-track-arm-template
9
9
- build-2025
10
-
ms.date: 01/15/2026
10
+
ms.date: 01/16/2026
11
11
---
12
12
13
13
# Bicep core diagnostics
14
14
15
15
If you need more information about a particular diagnostic code, select the **Feedback** button in the upper-right corner of the page and specify the code.
16
16
17
+
You can suppress Bicep diagnostic codes by using the `disable-next-line` directive. See [`disable-next-line`](./file.md#disable-next-line).
18
+
17
19
| Code | Level | Description |
18
20
|------------|-------|-------------|
19
21
| <aid='BCP001' />BCP001 | Error | The following token isn't recognized: `{token}`. |
@@ -12,13 +12,21 @@ This article describes the structure and syntax of a Bicep file. It presents the
12
12
13
13
For a step-by-step tutorial that guides you through the process of creating a Bicep file, see [Quickstart: Create Bicep files with Visual Studio Code](./quickstart-create-bicep-use-visual-studio-code.md).
14
14
15
+
## Known limitations
16
+
17
+
* Support isn't available for the concept of `apiProfile`, which is used to map a single `apiProfile` to a set `apiVersion` for each resource type.
18
+
* User-defined functions aren't supported at this time. An experimental feature is currently accessible. For more information, see [User-defined functions in Bicep](./user-defined-functions.md).
19
+
* Some Bicep features require a corresponding change to the intermediate language (Azure Resource Manager JSON templates). We announce these features as available after all the required updates are deployed to global Azure. If you use a different environment such as Azure Stack, there might be a delay in the availability of the feature. The Bicep feature is available only after the intermediate language is also updated in that environment.
20
+
15
21
## Bicep format
16
22
17
23
Bicep is a declarative language, which means the elements can appear in any order. Unlike imperative languages, the order of elements doesn't affect how deployment is processed.
18
24
19
25
A Bicep file has the following elements:
20
26
21
27
```bicep
28
+
#<directive-name> <argument> [<argument> ...]
29
+
22
30
@<decorator>(<argument>)
23
31
metadata <metadata-name> = ANY
24
32
@@ -106,35 +114,6 @@ The allowed values are:
106
114
107
115
In a module, you can specify a scope that's different than the scope for the rest of the Bicep file. For more information, see [Configure module scope](modules.md#set-module-scope).
108
116
109
-
## Decorators
110
-
111
-
You can add one or more decorators for each of the following elements:
112
-
113
-
*[param](#parameters)
114
-
*[var](#variables)
115
-
*[resource](#resources)
116
-
*[module](#modules)
117
-
*[output](#outputs)
118
-
*[func](#functions)
119
-
*[type](#types)
120
-
121
-
The following table lists the decorators:
122
-
123
-
| Decorator | Apply to element | Apply to data type | Argument | Description |
124
-
| --------- | ---- | ----------- | ------- |
125
-
| allowed |[param](./parameters.md#allowed-values)| all | array | Use this decorator to make sure the user provides correct values. This decorator is permitted only 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). You can also use union type syntax in `param` statements.|
126
-
| batchSize |[module](./modules.md#batchsize), [resource](./resource-declaration.md#batchsize)| N/A | integer | Set up instances to deploy sequentially. |
127
-
| description |[func](./user-defined-functions.md#description), [param](./parameters.md#description), [module](./modules.md#description), [output](./outputs.md#description), [resource](./resource-declaration.md#description), [type](./user-defined-data-types.md#description), [var](./variables.md#description)| all | string | Provide descriptions for the elements. Use Markdown-formatted text for the description text. |
128
-
| discriminator |[param](./parameters.md#discriminator), [type](./user-defined-data-types.md#discriminator), [output](./outputs.md#discriminator)| object | string | Use this decorator to ensure that the correct subclass is identified and managed. For more information, see [Custom-tagged union data type](./data-types.md#custom-tagged-union-data-type).|
129
-
| export |[func](./user-defined-functions.md#export), [type](./user-defined-data-types.md#export), [var](./variables.md#export)| all | none| Indicates that another Bicep file can import the element. |
130
-
| maxLength |[param](./parameters.md#length-constraints), [output](./outputs.md#length-constraints), [type](./user-defined-data-types.md#length-constraints)| array, string | int | The maximum length for string and array elements. The value is inclusive. |
131
-
| maxValue |[param](./parameters.md#integer-constraints), [output](./outputs.md#integer-constraints), [type](./user-defined-data-types.md#integer-constraints)| int | int | The maximum value for the integer elements. This value is inclusive. |
132
-
| metadata |[func](./user-defined-functions.md#metadata), [output](./outputs.md#metadata), [param](./parameters.md#metadata), [type](./user-defined-data-types.md#metadata)| all | object | Custom properties to apply to the elements. Can include a description property that's equivalent to the description decorator. |
133
-
| minLength |[param](./parameters.md#length-constraints), [output](./outputs.md#length-constraints), [type](./user-defined-data-types.md#length-constraints)| array, string | int | The minimum length for string and array elements. The value is inclusive. |
134
-
| minValue |[param](./parameters.md#integer-constraints), [output](./outputs.md#integer-constraints), [type](./user-defined-data-types.md#integer-constraints)| int | int | The minimum value for the integer elements. This value is inclusive. |
135
-
| sealed |[param](./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 user-defined data type is likely a typo. For more information, see [Elevate error level](./user-defined-data-types.md#elevate-error-level). |
136
-
| secure |[param](./parameters.md#secure-parameters), [type](./user-defined-data-types.md#secure-types)| 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). |
137
-
138
117
## Parameters
139
118
140
119
Use parameters for values that need to vary for different deployments. You can define a default value for the parameter that's used if a value isn't provided during deployment.
@@ -176,51 +155,6 @@ You can add one or more decorators for each variable. For more information, see
176
155
177
156
For more information, see [Variables in Bicep](./variables.md).
178
157
179
-
## Types
180
-
181
-
You can use the `type` statement to define user-defined data types.
182
-
183
-
```bicep
184
-
param location string = resourceGroup().location
185
-
186
-
type storageAccountSkuType = 'Standard_LRS' | 'Standard_GRS'
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).
209
-
210
-
For more information, see [User-defined data types in Bicep](./user-defined-data-types.md).
211
-
212
-
## Functions
213
-
214
-
In your Bicep file, you can create your own functions and also use the [standard Bicep functions](./bicep-functions.md) that are automatically available within your Bicep files. Create your own functions when you have complicated expressions that are used repeatedly in your Bicep files.
For more information, see [User-defined functions in Bicep](./user-defined-functions.md).
223
-
224
158
## Resources
225
159
226
160
Use the `resource` keyword to define a resource to deploy. Your resource declaration includes a symbolic name for the resource. You use this symbolic name in other parts of the Bicep file to get a value from the resource.
@@ -325,6 +259,124 @@ You can add one or more decorators for each output. For more information, see [U
325
259
326
260
For more information, see [Outputs in Bicep](./outputs.md).
327
261
262
+
## Types
263
+
264
+
You can use the `type` statement to define user-defined data types.
265
+
266
+
```bicep
267
+
param location string = resourceGroup().location
268
+
269
+
type storageAccountSkuType = 'Standard_LRS' | 'Standard_GRS'
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).
292
+
293
+
For more information, see [User-defined data types in Bicep](./user-defined-data-types.md).
294
+
295
+
## Functions
296
+
297
+
In your Bicep file, you can create your own functions and also use the [standard Bicep functions](./bicep-functions.md) that are automatically available within your Bicep files. Create your own functions when you have complicated expressions that are used repeatedly in your Bicep files.
For more information, see [User-defined functions in Bicep](./user-defined-functions.md).
306
+
307
+
## Decorators
308
+
309
+
You can add one or more decorators for each of the following elements:
310
+
311
+
*[param](#parameters)
312
+
*[var](#variables)
313
+
*[resource](#resources)
314
+
*[module](#modules)
315
+
*[output](#outputs)
316
+
*[func](#functions)
317
+
*[type](#types)
318
+
319
+
The following table lists the decorators:
320
+
321
+
| Decorator | Apply to element | Apply to data type | Argument | Description |
322
+
| --------- | ---- | ----------- | ------- |
323
+
| allowed |[param](./parameters.md#allowed-values)| all | array | Use this decorator to make sure the user provides correct values. This decorator is permitted only 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). You can also use union type syntax in `param` statements.|
324
+
| batchSize |[module](./modules.md#batchsize), [resource](./resource-declaration.md#batchsize)| N/A | integer | Set up instances to deploy sequentially. |
325
+
| description |[func](./user-defined-functions.md#description), [param](./parameters.md#description), [module](./modules.md#description), [output](./outputs.md#description), [resource](./resource-declaration.md#description), [type](./user-defined-data-types.md#description), [var](./variables.md#description)| all | string | Provide descriptions for the elements. Use Markdown-formatted text for the description text. |
326
+
| discriminator |[param](./parameters.md#discriminator), [type](./user-defined-data-types.md#discriminator), [output](./outputs.md#discriminator)| object | string | Use this decorator to ensure that the correct subclass is identified and managed. For more information, see [Custom-tagged union data type](./data-types.md#custom-tagged-union-data-type).|
327
+
| export |[func](./user-defined-functions.md#export), [type](./user-defined-data-types.md#export), [var](./variables.md#export)| all | none| Indicates that another Bicep file can import the element. |
328
+
| maxLength |[param](./parameters.md#length-constraints), [output](./outputs.md#length-constraints), [type](./user-defined-data-types.md#length-constraints)| array, string | int | The maximum length for string and array elements. The value is inclusive. |
329
+
| maxValue |[param](./parameters.md#integer-constraints), [output](./outputs.md#integer-constraints), [type](./user-defined-data-types.md#integer-constraints)| int | int | The maximum value for the integer elements. This value is inclusive. |
330
+
| metadata |[func](./user-defined-functions.md#metadata), [output](./outputs.md#metadata), [param](./parameters.md#metadata), [type](./user-defined-data-types.md#metadata)| all | object | Custom properties to apply to the elements. Can include a description property that's equivalent to the description decorator. |
331
+
| minLength |[param](./parameters.md#length-constraints), [output](./outputs.md#length-constraints), [type](./user-defined-data-types.md#length-constraints)| array, string | int | The minimum length for string and array elements. The value is inclusive. |
332
+
| minValue |[param](./parameters.md#integer-constraints), [output](./outputs.md#integer-constraints), [type](./user-defined-data-types.md#integer-constraints)| int | int | The minimum value for the integer elements. This value is inclusive. |
333
+
| sealed |[param](./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 user-defined data type is likely a typo. For more information, see [Elevate error level](./user-defined-data-types.md#elevate-error-level). |
334
+
| secure |[param](./parameters.md#secure-parameters), [type](./user-defined-data-types.md#secure-types)| 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). |
335
+
336
+
## Directives
337
+
338
+
Directives provide instructions to the Bicep compiler and linter without affecting the runtime behavior of a template. You write directives as comments. The compiler evaluates them during compilation and validation.
339
+
340
+
A directive uses the following general syntax:
341
+
342
+
```bicep
343
+
#<directive-name> <argument1> [<argument2> ... ]
344
+
```
345
+
346
+
You separate arguments by using spaces. The specific directive determines how to interpret the arguments.
347
+
348
+
### `disable-next-line`
349
+
350
+
Use the `#disable-next-line` directive to suppress diagnostics for the statement immediately following the directive. You must specify at least one identifier after the directive. If you don't provide any identifiers, the compiler reports an error. The identifiers you specify after the directive can refer to:
351
+
352
+
*[Bicep compiler diagnostics](./bicep-core-diagnostics.md), such as `BCP138`
353
+
*[Bicep linter rules](./linter.md), such as `no-unused-params`
354
+
355
+
The following example suppresses a compiler diagnostic:
The following example suppresses multiple diagnostics and rules:
372
+
373
+
```bicep
374
+
#disable-next-line BCP138 no-unused-params
375
+
param example string
376
+
```
377
+
378
+
Use directives sparingly and only when you review and intentionally suppress a diagnostic or linter rule. Excessive use can reduce template readability and maintainability. Add a comment explaining why the rules or the diagnostic codes don't apply to this line.
379
+
328
380
## Loops
329
381
330
382
Add iterative loops to your Bicep file to define multiple copies of:
@@ -452,12 +504,6 @@ var foo = resourceGroup(
452
504
453
505
For multiple-line declaration samples, see [arrays](./data-types.md#arrays) and [objects](./data-types.md#objects).
454
506
455
-
## Known limitations
456
-
457
-
* Support isn't available for the concept of `apiProfile`, which is used to map a single `apiProfile` to a set `apiVersion` for each resource type.
458
-
* User-defined functions aren't supported at this time. An experimental feature is currently accessible. For more information, see [User-defined functions in Bicep](./user-defined-functions.md).
459
-
* Some Bicep features require a corresponding change to the intermediate language (Azure Resource Manager JSON templates). We announce these features as available after all the required updates are deployed to global Azure. If you use a different environment such as Azure Stack, there might be a delay in the availability of the feature. The Bicep feature is available only after the intermediate language is also updated in that environment.
460
-
461
507
## Related content
462
508
463
509
* For an introduction to Bicep, see [What is Bicep?](./overview.md).
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/linter.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: Use Bicep linter
3
3
description: Learn how to use Bicep linter.
4
4
ms.topic: how-to
5
5
ms.custom: devx-track-bicep
6
-
ms.date: 12/22/2025
6
+
ms.date: 01/16/2026
7
7
---
8
8
9
9
# Use Bicep linter
@@ -92,19 +92,18 @@ You can integrate these checks as a part of your CI/CD pipelines. You can use a
92
92
93
93
## Silencing false positives
94
94
95
-
Sometimes a rule can have false positives. For example, you might need to include a link to a blob storage directly without using the [environment()](./bicep-functions-deployment.md#environment) function.
96
-
In this case you can disable the warning for one line only, not the entire document, by adding `#disable-next-line <rule name>` before the line with the warning.
95
+
Sometimes a rule has false positives. For example, you might need to include a link to a blob storage directly without using the [environment()](./bicep-functions-deployment.md#environment) function.
96
+
97
+
In this case, you can disable the warning for one line only, not the entire document, by adding the `#disable-next-line` directive before the line with the warning.
97
98
98
99
```bicep
99
100
#disable-next-line no-hardcoded-env-urls //Direct download link to my toolset
Multiple codes may be listed, separated by spaces.
104
-
105
-
It's good practice to add a comment explaining why the rule doesn't apply to this line.
104
+
For more information about using directives in Bicep, see [Directives](./file.md#directives).
106
105
107
-
If you want to suppress a linter rule, you can change the level of the rule to `Off` in [bicepconfig.json](./bicep-config-linter.md). For example, in the following example, the `no-deployments-resources` rule is suppressed:
106
+
If you want to suppress a linter rule, change the level of the rule to `Off` in [bicepconfig.json](./bicep-config-linter.md). In the following example, the `no-deployments-resources` rule is suppressed:
0 commit comments