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/templates/template-functions-array.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
@@ -748,16 +748,16 @@ The output from the preceding example with the default values is:
748
748
749
749
`tryGet(sourceArray, keyOrIndex)`
750
750
751
-
`tryGet` helps you avoid deployment failures when trying to access a non-existent property or index in an object or array. If the specified key or index does not exist, `tryGet` returns null instead of throwing an error. You might need to use the function in conjunction with [nullable types](./data-types.md#nullable-types).
751
+
`tryGet` helps you avoid deployment failures when trying to access a non-existent property or index in an object or array. If the specified key or index does not exist, `tryGet` returns null instead of throwing an error.
752
752
753
753
In Bicep, use the [safe-dereference](../bicep/operator-safe-dereference.md#safe-dereference) operator.
754
754
755
755
### Parameters
756
756
757
757
| Parameter | Required | Type | Description |
758
758
|:--- |:--- |:--- |:--- |
759
-
| sourceArray |Yes |array, object |The value to check if it's empty. |
760
-
| keyOrIndex |Yes |string, int |The key or index to retrieve from the array or object. A property name for objects or index for arrays.|
759
+
| sourceArray |Yes |array, object |An object or array to look into. |
760
+
| keyOrIndex |Yes |string, int |A key or index to retrieve from the array or object. A property name for objects or index for arrays.|
description: Describes the functions to use in an Azure Resource Manager template (ARM template) for working with objects.
4
4
ms.topic: reference
5
5
ms.custom: devx-track-arm-template
6
-
ms.date: 02/12/2025
6
+
ms.date: 07/10/2025
7
7
---
8
8
9
9
# Object functions for ARM templates
@@ -540,6 +540,73 @@ The output from the preceding example with the default values is:
540
540
541
541
**secondOutput** shows the shallow merge doesn't recursively merge these nested objects. Instead, the entire nested object is replaced by the corresponding property from the merging object.
542
542
543
+
## tryGet
544
+
545
+
`tryGet(sourceArray, keyOrIndex)`
546
+
547
+
`tryGet` helps you avoid deployment failures when trying to access a non-existent property or index in an object or array. If the specified key or index doesn't exist, `tryGet` returns null instead of throwing an error.
548
+
549
+
In Bicep, use the [safe-dereference](../bicep/operator-safe-dereference.md#safe-dereference) operator.
550
+
551
+
### Parameters
552
+
553
+
| Parameter | Required | Type | Description |
554
+
|:--- |:--- |:--- |:--- |
555
+
| sourceArray |Yes |array, object |An object or array to look into. |
556
+
| keyOrIndex |Yes |string, int |A key or index to retrieve from the array or object. A property name for objects or index for arrays.|
557
+
558
+
### Return value
559
+
560
+
Returns the value at the key/index if it exists. Returns null if the key/index is missing or out of bounds.
561
+
562
+
### Example
563
+
564
+
The following example checks whether an array, object, and string are empty.
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/templates/template-functions.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
@@ -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: 07/07/2025
6
+
ms.date: 07/10/2025
7
7
---
8
8
9
9
# ARM template functions
@@ -64,6 +64,7 @@ Resource Manager provides several functions for working with arrays.
0 commit comments