Skip to content

Commit 3699de5

Browse files
committed
Add @secure() to type
1 parent 7f7be0f commit 3699de5

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Bicep is a declarative language, which means the elements can appear in any orde
1919
A Bicep file has the following elements.
2020

2121
```bicep
22+
@<decorator>(<argument>)
2223
metadata <metadata-name> = ANY
2324
2425
targetScope = '<scope>'
@@ -48,6 +49,7 @@ module <module-symbolic-name> '<path-to-file>' = {
4849
}
4950
}
5051
52+
@<decorator>(<argument>)
5153
output <output-name> <output-data-type> = <output-value>
5254
```
5355

@@ -119,17 +121,17 @@ You can add one or more decorators for each of the following elements:
119121
| Decorator | Apply to element | Apply to data type | Argument | Description |
120122
| --------- | ---- | ----------- | ------- |
121123
| allowed | [param](./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.|
122-
| batchSize |[resource](./resource-declaration.md#batchsize), [module](./modules.md#batchsize)| N/A | integer | Set up instances to deploy sequentially. |
123-
| description | [param](./parameters.md#description), [var](./variables.md#description), [resource](./resource-declaration.md#description), [module](./modules.md#description), [output](./outputs.md#description), [type](./user-defined-data-types.md#description), [func](./user-defined-functions.md#description) | all | string | Provide descriptions for the elements. Markdown-formatted text can be used for the description text. |
124+
| batchSize |[module](./modules.md#batchsize), [resource](./resource-declaration.md#batchsize) | N/A | integer | Set up instances to deploy sequentially. |
125+
| 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. Markdown-formatted text can be used for the description text. |
124126
| discriminator | [param](./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).|
125-
| export | [var](./variables.md#export), [type](./user-defined-data-types.md#export), [func](./user-defined-functions.md#export) | all | none| Indicates that the element can be imported by another Bicep file. |
127+
| export | [func](./user-defined-functions.md#export), [type](./user-defined-data-types.md#export), [var](./variables.md#export) | all | none| Indicates that the element can be imported by another Bicep file. |
126128
| maxLength | [param](./parameters.md#length-constraints), [output](./outputs.md#length-constraints) | array, string | int | The maximum length for string and array elements. The value is inclusive. |
127129
| maxValue | [param](./parameters.md#integer-constraints), [output](./outputs.md#integer-constraints) | int | int | The maximum value for the integer elements. This value is inclusive. |
128130
| metadata | [param](./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. |
129131
| minLength | [param](./parameters.md#length-constraints), [output](./outputs.md#length-constraints) | array, string | int | The minimum length for string and array elements. The value is inclusive. |
130132
| minValue | [param](./parameters.md#integer-constraints), [output](./outputs.md#integer-constraints) | int | int | The minimum value for the integer elements. This value is inclusive. |
131133
| 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 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 | [param](./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). |
134+
| secure | [param](./parameters.md#secure-parameters), [type](./user-defined-data-types.md#sealed) | 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). |
133135

134136
## Parameters
135137

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ Decorators are written in the format `@expression` and are placed above the decl
238238
| [discriminator](#discriminator) | string | Use this decorator to ensure the correct subclass is identified and managed. |
239239
| [export](#export) | none | Indicates that the user-defined data type is available for import by another Bicep file. |
240240
| [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).|
241+
| [secure](#secure-parameters) | string, object | none | Marks the types as secure. The value for a secure type 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). |
241242

242243
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.
243244

@@ -271,6 +272,18 @@ Use `@export()` to share the user-defined data type with other Bicep files. For
271272

272273
See [Elevate error level](#elevate-error-level).
273274

275+
### Secure types
276+
277+
You can mark string or object user-defined data type as secure. The value of a secure type isn't saved to the deployment history and isn't logged.
278+
279+
```bicep
280+
@secure()
281+
type demoPassword string
282+
283+
@secure()
284+
type demoSecretObject object
285+
```
286+
274287
## Elevate error level
275288

276289
By default, declaring an object type in Bicep allows it to accept additional properties of any type. For example, the following Bicep is valid but raises a warning of [BCP089] - `The property "otionalProperty" is not allowed on objects of type "{ property: string, optionalProperty: null | string }". Did you mean "optionalProperty"?`:

0 commit comments

Comments
 (0)