@@ -3,7 +3,7 @@ title: Template functions - objects
3
3
description : Describes the functions to use in an Azure Resource Manager template (ARM template) for working with objects.
4
4
ms.topic : conceptual
5
5
ms.custom : devx-track-arm-template
6
- ms.date : 01/11 /2024
6
+ ms.date : 05/09 /2024
7
7
---
8
8
9
9
# Object functions for ARM templates
@@ -44,7 +44,7 @@ In Bicep, use the [contains](../bicep/bicep-functions-object.md#contains) functi
44
44
45
45
### Example
46
46
47
- The following example shows how to use contains with different types:
47
+ The following example shows how to use ` contains ` with different types:
48
48
49
49
:::code language="json" source="~ /resourcemanager-templates/azure-resource-manager/functions/array/contains.json":::
50
50
@@ -154,7 +154,7 @@ An array or object with the common elements.
154
154
155
155
### Example
156
156
157
- The following example shows how to use intersection with arrays and objects.
157
+ The following example shows how to use ` intersection ` with arrays and objects.
158
158
159
159
:::code language="json" source="~ /resourcemanager-templates/azure-resource-manager/functions/array/intersection.json":::
160
160
@@ -369,7 +369,7 @@ An int.
369
369
370
370
### Example
371
371
372
- The following example shows how to use length with an array and string:
372
+ The following example shows how to use ` length ` with an array and string:
373
373
374
374
:::code language="json" source="~ /resourcemanager-templates/azure-resource-manager/functions/array/length.json":::
375
375
@@ -409,6 +409,55 @@ The output from the preceding example is:
409
409
| ---- | ---- | ----- |
410
410
| emptyOutput | Bool | True |
411
411
412
+ ## objectKeys
413
+
414
+ ` objectKey(arg1) `
415
+
416
+ Returns the keys from an object, where an object is a collection of key-value pairs.
417
+
418
+ In Bicep, use the [ objectKeys] ( ../templates/template-functions-object.md#objectkeys ) function.
419
+
420
+ ### Parameters
421
+
422
+ | Parameter | Required | Type | Description |
423
+ | :--- | :--- | :--- | :--- |
424
+ | arg1 | Yes | object | The object which is a collection of key-value pairs. |
425
+
426
+ ### Return value
427
+
428
+ An array.
429
+
430
+ ### Example
431
+
432
+ The following example shows how to use ` objectKeys ` with an object:
433
+
434
+ ``` json
435
+ {
436
+ "$schema" : " https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#" ,
437
+ "contentVersion" : " 1.0.0.0" ,
438
+ "variables" : {
439
+ "obj" : {
440
+ "a" : 1 ,
441
+ "b" : 2
442
+ },
443
+ "keys" : " [objectKeys(variables('obj'))]"
444
+ },
445
+ "resources" : [],
446
+ "outputs" : {
447
+ "keyArray" : {
448
+ "type" : " array" ,
449
+ "value" : " [variables('keys')]"
450
+ }
451
+ }
452
+ }
453
+ ```
454
+
455
+ The output from the preceding example is:
456
+
457
+ | Name | Type | Value |
458
+ | ---- | ---- | ----- |
459
+ | keyArray | Array | [ "a", "b" ] |
460
+
412
461
## union
413
462
414
463
` union(arg1, arg2, arg3, ...) `
@@ -441,7 +490,7 @@ The union function merges not only the top-level elements but also recursively m
441
490
442
491
### Example
443
492
444
- The following example shows how to use union with arrays and objects:
493
+ The following example shows how to use ` union ` with arrays and objects:
445
494
446
495
:::code language="json" source="~ /resourcemanager-templates/azure-resource-manager/functions/array/union.json":::
447
496
0 commit comments