Skip to content

Commit 095cb36

Browse files
committed
Bicep objectKeys function()
1 parent 2a722a5 commit 095cb36

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

articles/azure-resource-manager/bicep/bicep-functions-object.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Bicep functions - objects
33
description: Describes the functions to use in a Bicep file for working with objects.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 01/11/2024
6+
ms.date: 05/09/2024
77
---
88

99
# Object functions for Bicep
@@ -385,6 +385,41 @@ The output from the preceding example with the default values is:
385385
| stringLength | Int | 13 |
386386
| objectLength | Int | 4 |
387387

388+
## objectKeys
389+
390+
`objectKey(arg1)`
391+
392+
Returns the keys from an object, where an object is a collection of key-value pairs.
393+
394+
Namespace: [sys](bicep-functions.md#namespaces-for-functions).
395+
396+
### Parameters
397+
398+
| Parameter | Required | Type | Description |
399+
|:--- |:--- |:--- |:--- |
400+
| arg1 |Yes |object |The object which is a collection of key-value pairs. |
401+
402+
### Return value
403+
404+
An array.
405+
406+
### Example
407+
408+
The following example shows how to use length with an array and string:
409+
410+
```bicep
411+
var obj = { a: 1, b: 2 }
412+
var keys = objectKeys(obj) // returns
413+
414+
output keyArray array = keys
415+
```
416+
417+
The output from the preceding example is:
418+
419+
| Name | Type | Value |
420+
| ---- | ---- | ----- |
421+
| keyArray | Array | [ "a", "b" ] |
422+
388423
## union
389424

390425
`union(arg1, arg2, arg3, ...)`

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Bicep functions
33
description: Describes the functions to use in a Bicep file to retrieve values, work with strings and numerics, and retrieve deployment information.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 06/05/2023
6+
ms.date: 05/09/2024
77
---
88

99
# Bicep functions
@@ -119,6 +119,7 @@ The following functions are available for working with objects. All of these fun
119119
* [items](./bicep-functions-object.md#items)
120120
* [json](./bicep-functions-object.md#json)
121121
* [length](./bicep-functions-object.md#length)
122+
* [objectKeys](./bicep-functions-object.md#objectkeys)
122123
* [union](./bicep-functions-object.md#union)
123124

124125
## Parameters file functions

0 commit comments

Comments
 (0)