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/data-types.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Data types in Bicep
3
3
description: This article describes the data types that are available in Bicep.
4
4
ms.topic: reference
5
-
ms.date: 05/20/2025
5
+
ms.date: 06/30/2025
6
6
ms.custom: devx-track-bicep
7
7
---
8
8
@@ -66,7 +66,7 @@ var index = 1
66
66
output secondElement int = exampleArray[index] // 2
67
67
```
68
68
69
-
Starting with [Bicep CLI version 0.34.x](https://github.com/Azure/bicep/releases/tag/v0.34.1), you can use the `array[^index]` syntax to access elements from the end of an array —`^1` refers to the last element, `^2` to the second-to-last, and so on.
69
+
Starting with [Bicep CLI version 0.34.x](https://github.com/Azure/bicep/releases/tag/v0.34.1), you can use the `array[^index]` syntax to access elements from the end of an array -`^1` refers to the last element, `^2` to the second-to-last, and so on.
70
70
71
71
```bicep
72
72
var exampleArray = [1, 2, 3]
@@ -325,7 +325,7 @@ var storageName = 'storage${uniqueString(resourceGroup().id)}'
325
325
In Bicep, multi-line strings are defined between three single quotation marks (`'''`) followed optionally by a newline (the opening sequence) and three single quotation marks (`'''` is the closing sequence). Characters that are entered between the opening and closing sequence are read verbatim. Escaping isn't necessary or possible.
326
326
327
327
> [!NOTE]
328
-
> The Bicep parser reads every characters as it is. Depending on the line endings of your Bicep file, newlines are interpreted as either `\r\n` or `\n`.
328
+
> The Bicep parser reads every character as it is. Depending on the line endings of your Bicep file, newlines are interpreted as either `\r\n` or `\n`.
329
329
>
330
330
> Interpolation isn't currently supported in multi-line strings. Because of this limitation, you might need to use the [`concat`](./bicep-functions-string.md#concat) function instead of using [interpolation](#strings).
For more information, see [Custom tagged union data type](./data-types.md#custom-tagged-union-data-type).
414
414
415
+
## Resource-derived types
416
+
417
+
Bicep allows you to derive types directly from Azure resource schemas using the `resourceInput<>` and `resourceOutput<>` constructs. Resource-derived types allow you to check parameters and variables against a portion of a resource body instead of with a custom type. [Bicep CLI version 0.34.1](https://github.com/Azure/bicep/releases/tag/v0.34.1) or higher is required to use these constructs.
418
+
419
+
Templates can reuse resource types wherever a type is expected.
420
+
421
+
```bicep
422
+
resourceInput<'type@version'>
423
+
```
424
+
425
+
`resourceInput<>`: Represents the writable properties of a resource type, stripping away any properties marked as ReadOnly in the ARM template schema. It uses the type that you would need to pass in to the resource declaration.
426
+
427
+
```bicep
428
+
resourceOutput<'type@version'>
429
+
```
430
+
431
+
`resourceOutput<>`: Represents the readable properties of a resource type, stripping away any properties marked as WriteOnly in the ARM template schema. It matches the type of value returned after the resource is provisioned.
432
+
433
+
You can apply `resourceInput<>` or `resourceOutput<>` to extract only a part of a resource schema. For example, to type a variable or parameter based on just the `kind` or `properties` of a storage account:
434
+
435
+
```bicep
436
+
type accountKind = resourceInput<'Microsoft.Storage/storageAccounts@2024-01-01'>.kind
The following example shows how to use `resourceInput<>` to create a typed parameter based on the `properties` of a storage account resource. This allows you to define a parameter that matches the writable properties of a storage account, such as `accessTier`, `minimumTlsVersion`, and others:
446
+
447
+
```bicep
448
+
// Typed parameter using the .properties path of a storage account
Unlike user-defined data types, resource-derived types are checked by Bicep when editing or compiling a file, but they aren't checked by the ARM service.
475
+
415
476
## Related content
416
477
417
478
For a list of the Bicep data types, see [Data types](./data-types.md).
0 commit comments