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
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/10/2025
7
7
---
8
8
9
9
# Array functions for ARM templates
@@ -693,6 +693,73 @@ The output from the preceding example with the default values is:
693
693
| arrayOutput | Array |["one", "two"]|
694
694
| stringOutput | String | on |
695
695
696
+
## tryGet
697
+
698
+
`tryGet(sourceArray, keyOrIndex)`
699
+
700
+
`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).
701
+
702
+
In Bicep, use the [safe-dereference](../bicep/operator-safe-dereference.md#safe-dereference) operator.
703
+
704
+
### Parameters
705
+
706
+
| Parameter | Required | Type | Description |
707
+
|:--- |:--- |:--- |:--- |
708
+
| sourceArray |Yes |array, object |The value to check if it's empty. |
709
+
| keyOrIndex |Yes |string, int |The key or index to retrieve from the array or object. A property name for objects or index for arrays.|
710
+
711
+
### Return value
712
+
713
+
Returns the value at the key/index if it exists. Returns null if the key/index is missing or out of bounds.
714
+
715
+
### Example
716
+
717
+
The following example checks whether an array, object, and string are empty.
0 commit comments