Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article
Applies to: ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Checks whether a dynamic property bag object contains a given key.
bag_has_key(
bag,
key)
Learn more about syntax conventions.
Name | Type | Required | Description |
---|---|---|---|
bag | dynamic |
✔️ | The property bag to search. |
key | string |
✔️ | The key for which to search. Search for a nested key using the JSONPath notation. Array indexing isn't supported. |
True or false depending on if the key exists in the bag.
datatable(input: dynamic)
[
dynamic({'key1' : 123, 'key2': 'abc'}),
dynamic({'key1' : 123, 'key3': 'abc'}),
]
| extend result = bag_has_key(input, 'key2')
Output
input | result |
---|---|
{ "key1": 123, "key2": "abc" } |
true |
{ "key1": 123, "key3": "abc" } |
false |
datatable(input: dynamic)
[
dynamic({'key1': 123, 'key2': {'prop1' : 'abc', 'prop2': 'xyz'}, 'key3': [100, 200]}),
]
| extend result = bag_has_key(input, '$.key2.prop1')
Output
input | result |
---|---|
{ "key1": 123, "key2": { "prop1": "abc", "prop2": "xyz" }, "key3": [ 100, 200 ] } |
true |