Replace function in Azure Resource Graph Explorer

Giorgos Georgiadis 21 Reputation points
2022-08-24T05:47:27.873+00:00

Hi

I need some help on a query I am building

Resources
| where type == "microsoft.storage/storageaccounts"
| extend keysource = tostring(properties.encryption.keySource)
| extend keysource1 = replace(keysource, 'Microsoft.Keyvault' , 'EncryptionAtRestWithCustomerKey')
| project keysource1

The query fails with an unexpected error

Details:
An unexpected query execution error occurred. Please try again later. (Code:UnexpectedQueryExecutionError)

The documentation for Azure Resource Graph Explorer does not mention the replace function as supported, but in the query builder it seems that it is supported.

This is what I get if I just write the word replace


The function 'replace' requires an argument list.
(function) replace(regex, rewrite, text): string

The function 'replace' requires an argument list.


So it seems to be supported but I cannot understand why it fails.

My goal is to get the properties.encryption.keySource output and if the says Microsoft.Keyvault to replace it with the EncryptionAtRestWithCustomerKey string.

Any ideas before I go to MS support?

Thanks in advance

GG

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,645 questions
{count} votes

Accepted answer
  1. Maxim Sergeev 6,586 Reputation points Microsoft Employee
    2022-08-26T02:00:47.54+00:00

    Hi @Giorgos Georgiadis ,

    A simple answer - no, it's not supported today. ARG is quite limited with kusto operators.
    A list of supported operators here https://learn.microsoft.com/en-us/azure/governance/resource-graph/concepts/query-language#supported-tabulartop-level-operators

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.