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
+11-1Lines changed: 11 additions & 1 deletion
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: 06/30/2025
5
+
ms.date: 07/07/2025
6
6
ms.custom: devx-track-bicep
7
7
---
8
8
@@ -437,6 +437,16 @@ The union type has some limitations:
437
437
438
438
You can use the union type syntax in [user-defined data types](./user-defined-data-types.md).
439
439
440
+
## Nullable types
441
+
442
+
You can make any primitive or complex type nullable by appending a `?` to the type name. This allows the parameter, variable, or output to accept null as a valid value. For example:
443
+
444
+
```bicep
445
+
output description string? = null
446
+
output config object? = null
447
+
output optionalValue int? = null
448
+
```
449
+
440
450
## Secure strings and objects
441
451
442
452
Secure strings use the same format as string, and secure objects use the same format as object. With Bicep, you add the `@secure()`[decorator](./parameters.md#use-decorators) to a string or object.
description: Describes the functions to use in an Azure Resource Manager template (ARM template) for working with arrays.
4
4
ms.topic: reference
5
5
ms.custom: devx-track-arm-template
6
-
ms.date: 02/12/2025
6
+
ms.date: 07/07/2025
7
7
---
8
8
9
9
# Array functions for ARM templates
@@ -223,6 +223,57 @@ The output from the preceding example with the default values is:
223
223
| arrayOutput | String | one |
224
224
| stringOutput | String | O |
225
225
226
+
## indexFromEnd
227
+
228
+
`indexFromEnd(sourceArray, reverseIndex)`
229
+
230
+
Returns an element of the array by counting backwards from the end. This is useful when you want to reference elements starting from the end of a list, rather than the beginning. The [`tryIndexFromEnd`](#tryindexfromend) function is a safe version of `indexFromEnd`.
231
+
232
+
In Bicep, use the [Reserved index accessor](../bicep/operators-access.md#reverse-index-accessor) operator.
233
+
234
+
### Parameters
235
+
236
+
| Parameter | Required | Type | Description |
237
+
|:--- |:--- |:--- |:--- |
238
+
| sourceArray |Yes |array |The value to retrieve the element by counting backwards from the end. |
239
+
| reverseIndex |Yes |integer |The one-based index from the end of the array. |
240
+
241
+
### Return value
242
+
243
+
A single element from an array, selected by counting backward from the end of the array.
244
+
245
+
### Example
246
+
247
+
The following example shows how to use the `indexFromEnd` function.
The output from the preceding example with the default values is:
272
+
273
+
| Name | Type | Value |
274
+
| ---- | ---- | ----- |
275
+
| secondToLast | String | orange |
276
+
226
277
## indexOf
227
278
228
279
`indexOf(arrayToSearch, itemToFind)`
@@ -693,6 +744,92 @@ The output from the preceding example with the default values is:
693
744
| arrayOutput | Array |["one", "two"]|
694
745
| stringOutput | String | on |
695
746
747
+
## tryIndexFromEnd
748
+
749
+
`tryndexFromEnd(sourceArray, reverseIndex)`
750
+
751
+
The `tryIndexFromEnd` function is a safe version of [`indexFromEnd`](#indexfromend). It retrieves a value from an array by counting backward from the end without throwing an error if the index is out of range.
752
+
753
+
In Bicep, use the [Reserved index accessor](../bicep/operators-access.md#reverse-index-accessor) operator and the [Safe dereference](../bicep/operator-safe-dereference.md#safe-dereference) operator.
754
+
755
+
### Parameters
756
+
757
+
| Parameter | Required | Type | Description |
758
+
|:--- |:--- |:--- |:--- |
759
+
| sourceArray |Yes |array |The value to retrieve the element by counting backwards from the end. |
760
+
| reverseIndex |Yes |integer |The one-based index from the end of the array. |
761
+
762
+
### Return value
763
+
764
+
If the index is valid (within array bounds), returns the array element at that reverse index. If the index is out of range, returns null instead of throwing an error.
765
+
766
+
### Example
767
+
768
+
The following example shows how to use the `tryIndexFromEnd` function:
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/templates/template-functions.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Template functions
3
3
description: Describes the functions to use in an Azure Resource Manager template (ARM template) to retrieve values, work with strings and numerics, and retrieve deployment information.
4
4
ms.topic: reference
5
5
ms.custom: devx-track-arm-template
6
-
ms.date: 02/12/2025
6
+
ms.date: 07/07/2025
7
7
---
8
8
9
9
# ARM template functions
@@ -29,6 +29,7 @@ The [any function](../bicep/bicep-functions-any.md) is available in Bicep to hel
29
29
<aid="createarray"aria-hidden="true"></a>
30
30
<aid="empty"aria-hidden="true"></a>
31
31
<aid="first"aria-hidden="true"></a>
32
+
<aid="indexfromend"aria-hidden="true"></a>
32
33
<aid="indexof"aria-hidden="true"></a>
33
34
<aid="intersection"aria-hidden="true"></a>
34
35
<aid="last"aria-hidden="true"></a>
@@ -39,6 +40,7 @@ The [any function](../bicep/bicep-functions-any.md) is available in Bicep to hel
39
40
<aid="range"aria-hidden="true"></a>
40
41
<aid="skip"aria-hidden="true"></a>
41
42
<aid="take"aria-hidden="true"></a>
43
+
<aid="tryindexfromend"aria-hidden="true"></a>
42
44
<aid="union"aria-hidden="true"></a>
43
45
44
46
## Array functions
@@ -51,6 +53,7 @@ Resource Manager provides several functions for working with arrays.
0 commit comments